How to add date in MM/DD/YYY  format at the end of a string

Hi
I want Description to look like
' PARTICIPATION ON TEMPORARY TV SHOW EXPIRING ' and include the "latest show expiration date" as "MM/DD/YYYY"
Pls help ......
try {
                        Date date= new Date();
                         System.out.println("THE TODAYS DATE is :"+date);
                           DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
//                         DateFormat df = new SimpleDateFormat("MM/DD/YYYY");   -----> Its not allowing this format ????????
                         begin_Date = hashDateE.get(id);
                         System.out.println("THE LATEST TV SHOW DATE is :"+begin_Date);
                         Date d1 = df.parse(begin_Date);
                         String relation;
                         if(d1.equals(date))
                              relation = "both the dates are same";
                         else if(d1.before(date))
                              relation = "BEFORE";
                         else
                              relation = "AFTER";
                         //System.out.println(d1 + "is" + relation + ' ' + date);
                         if("10".equals(latestShow)){
                          if("BEFORE".equals(relation)){
                               System.out.println("The latest show date is expired");
                          Code =3;
                          Description = "PARTICIPATION ON TEMPORARY TV SHOW EXPIRED ";
                          else if("AFTER".equals(relation)) {
                               System.out.println("The latest show date is non expired");
                              Code = 2;
                               Description = "PARTICIPATION ON TEMPORARY TV SHOW EXPIRING" + d1; -------------> I TRIED THIS WAY ( d1 should be in this format MM/DD/YYY
                          }else {
                               System.out.println("The latest show date is non expired");
                             Code = 20;
                              Description = "PARTICIPATION ON TEMPORARY TV SHOW EXPIRING" + d1;
                    

If you have a string like 2008-12-15 and you want to interpret it as a date and format it as 12/15/2008, then you need two DateFormat objects.
One to parse the String in the first format into a Date, -------> i could do this
try {
          String begin_date = "2008-12-15";
          System.out.println("The begin date is :"+begin_date);
          DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
          Date d1 =  df.parse(begin_date);
          System.out.println("the Date value is d1 :"+d1);
catch() {
}Output is :The begin date is :2008-12-15
the Date value is d1 :Mon Dec 15 00:00:00 EST 2008
Pls help me with the second part :- ?????/
and one to format that Date into a String in the second format. MM/dd/yyyy --- how to do this ..after i tried several times with different statements , i am asking this piece of code to achieve this

Similar Messages

  • How to add date with month after convert number to month?

    How to add date with month after convert number to month?
    Month Date Result
    24 21/11/09 24*(21/11/09)
    I want to add both the column and result should be 21/11/11
    Thanks
    Nihar

    Hmm,
    Because, you are using YYYY for '09'.
    SQL> ed
    Wrote file afiedt.buf
      1* select to_char(to_date('10/01/09','DD/MM/RRRR'),'DD/MM/YYYY') from dual
    SQL> /
    TO_CHAR(TO
    10/01/2009
    SQL> ed
    Wrote file afiedt.buf
      1* select to_char(to_date('10/01/09','DD/MM/YYYY'),'DD/MM/YYYY') from dual
    SQL> /
    TO_CHAR(TO
    10/01/0009Or with Add_months
    SQL> ed
    Wrote file afiedt.buf
      1* select to_char(add_months(to_date('10/01/09','DD/MM/YYYY'),36),'DD/MM/YYYY') from dual
    SQL> /
    TO_CHAR(AD
    10/01/0012
    SQL> ed
    Wrote file afiedt.buf
      1* select to_char(add_months(to_date('10/01/09','DD/MM/RRRR'),36),'DD/MM/YYYY') from dual
    SQL> /
    TO_CHAR(AD
    10/01/2012-Arun

  • How to add a customer field or extn coll in the tab1&2&3..of a UDO doc?

    Hi Experts,
    Does anybody know how to add a customer field or extn collection in the unused  tabs like tab1&2...in a UDO document?
    Thanks for your reply in advance.
    Thanks & Regards,
    David

    Hi Subhasini - <br><br>
    It seems you have discovered that adding an extension field to the Project Suppliers collection is not possible; many of the collections in E-Sourcing do not support extensions and, even when they do, typically, the table view of the data cannot be changed to show the extension value (it would only show on a "details" page, for example.<br><br>
    The solution that you have proposed may work, although I think there is a slight mistake in your logic. I believe you are saying that the script would take data from the newly created extension collection and populate data in the out-of-the-box vendor collection. <br><br>
    In thinking about your solution, I believe the benefit is that any logic and reporting based on the standard collection continues to function correctly (e.g., creating an RFx from the Project will use the out-of-the-box vendor collection).<br><br>
    That being said, I generally am reluctant to do a "replace" of a standard collection with an extension collection as you propose. My recommendation is that you challenge the customer on the importance of this requirement. For example, could the code be maintained on the vendor record? Why is it maintained in Projects? If it is maintained in the vendor record, could you just populate a read only collection the Projects that shows the vendor and code? Could a report be written that can be launched from within the Project to show the values? How does the customer intend to use this field? Could the display name of the vendor object be the right place for it?<br><br>
    I hope these ideas are helpful.<br><br>
    Regards,<br><br>
    Rob<br><br>

  • How to Add a parameter of currency exchange rate in the selection screen

    Dear Friends,
    How to Add a parameter of currency exchange rate in the selection screen with format (9999.99999). wich field i need to take.
    Thanks,
    Sridhar

    TCURR-UKURS.
    ~Suresh

  • How to Insert date in 'DD/MM/YYYY' format in oracle using stored procedure?

    Hi
    How to Insert date in 'DD/MM/YYYY' format in oracle using stored procedure?
    This is my Input data.
    11/25/2007.
    By using below query, it is inserted into database.
    sql>Insert into tblname values(to_date('11/25/2007','MM/DD/YYYY'));
    But using stored procedure, the same query is not running.
    It shows error like
    ORA-01843: not a valid month ORA-06512: at line 1
    Procedure:
    create or replace procedure Date_Test(datejoin in DATE) is
    begin
    insert into datetest values(to_date(datejoin,'MM/DD/YYYY'));
    end Date_Test;
    I had used 'nls_date_language = american' also.
    Prcodeure is created but not worked in jsp. The same error is thrown.
    Pls provide a solution

    This might help you....
    SQL> Create Table DateTest(col1 Date);
    Table created.
    Elapsed: 00:00:00.00
    SQL> create or replace procedure Date_Test(datejoin in DATE) is
    2 begin
    3 insert into datetest values(to_date(datejoin,'MM/DD/YYYY'));
    4 end ;
    5 /
    Procedure created.
    Elapsed: 00:00:00.00
    SQL> exec Date_Test('11/25/2007');
    BEGIN Date_Test('11/25/2007'); END;
    ERROR at line 1:
    ORA-01843: not a valid month
    ORA-06512: at line 1
    Elapsed: 00:00:00.00
    SQL> exec Date_Test(To_Date('11/25/2007','mm/dd/yyyy'));
    BEGIN Date_Test(To_Date('11/25/2007','mm/dd/yyyy')); END;
    ERROR at line 1:
    ORA-01843: not a valid month
    ORA-06512: at "CTBATCH.DATE_TEST", line 3
    ORA-06512: at line 1
    Elapsed: 00:00:00.00
    SQL> create or replace procedure Date_Test(datejoin in DATE) is
    2 begin
    3 insert into datetest values(datejoin);
    4 end ;
    5 /
    Procedure created.
    Elapsed: 00:00:00.00
    SQL> exec Date_Test(To_Date('11/25/2007','mm/dd/yyyy'));
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.00
    SQL> Select * from DateTest;
    COL1
    25-NOV-07
    Elapsed: 00:00:00.00
    SQL> create or replace procedure Date_Test(datejoin in VarChar2) is
    2 begin
    3 insert into datetest values(to_date(datejoin,'mm/dd/yyyy'));
    4 end ;
    5 /
    Procedure created.
    Elapsed: 00:00:00.00
    SQL> exec Date_Test('11/25/2007');
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.00
    SQL> select * from DateTest;
    COL1
    25-NOV-07
    25-NOV-07
    Elapsed: 00:00:00.00
    SQL>

  • How to add a graphic watermark that is bigger than the photo?

    How to add a graphic watermark that is bigger than the photo?
         Basically I want to add a watermark that is a border, like "outside stroke" so that it doesn't clip the photo.
         Upper, left and right side are 10px and on the bottom is my signature that is 40px high. I know how to do this in Photoshop, but can't figgure it out in Lightroom.
         The inset function with negative numbers doesn't work, because it only export to the size of the exported image, instead it should resize the image with those 10px up, left and right and 40px on      the bottom.
    My bordes look like this either one of the two can be used, and if you scroll down you will se how the end result should look like.
    And below is what it should look like, so that Lightroom doesn't clip the photo.

    Are you sure the focus of your piano roll is on the right track? Are you zoomed in/out enough?

  • I need how to load data from MS Excel(csv format) to NW Excel

    Hi,
    I am doing Migration project from SAP MS to NW Manually.
    I need how to load data from MS excel (csv format) to NW excel .
    For example 2008 budget data.
    Could you please help me in this.
    Thanks and Regards
    Krishna

    Hi,
    You need to create a transformation file and a conversion file if required. First upload the excel (csv) file into BPC using Manage Data and Upload File option.
    Create the transformation file (refer to the sap help  on how to define a transformation file). You need to specify the mapping correctly and include all your application dimensions and map them to appropriate columns of the flat file.
    Before running the import package, do validate the data in the flat file you uploaded into BPC with the transformation file you created.
    Thanks,
    Sreeni

  • How to add a port for a IP cam in the airport extreme setting? thx!

    I has buy a IP cam, but I don't know how to add a port for a IP cam in the airport extreme setting? (I can see the IP cam in local, but not the internet.) Many Thanks!

    atwoodjordan, Welcome to the discussion area!
    See Steve Newstrum's user tip "How do I use Port Mapping (Part I)". When it talks about giving your Mac a static IP address just substitute camera instead.

  • Need help in laoding flat file data, which has \r at the end of a string

    Hi There,
    Need help in loading flat file data, which has \r at the end of a string.
    I have a flat file with three columns. In the data, at the end of second column it has \r. So because of this the control is going to the beginning of next line. And the rest of the line is loading into the next line.
    Can someone pls help me to remove escape character \r from the data?
    thanks,
    rag

    Have you looked into the sed linux command? here are some details:
    When working with txt files or with the shell in general it is sometimes necessary to replace certain chars in existing files. In that cases sed can come in handy:
    1     sed -i 's/foo/bar/g' FILENAME
    The -i option makes sure that the changes are saved in the new file – in case you are not sure that sed will work as you expect it you should use it without the option but provide an output filename. The s is for search, the foo is the pattern you are searching the file for, bar is the replacement string and the g flag makes sure that all hits on each line are replaced, not just the first one.
    If you have to replace special characters like a dot or a comma, they have to be entered with a backslash to make clear that you mean the chars, not some control command:
    1     sed -i 's/./,/g' *txt
    Sed should be available on every standard installation of any distribution. At lesat on Fedora it is even required by core system parts like udev.
    If this helps, mark as correct or helpful.

  • How to add data in a file

    hi,
    I have written following code.I have a file. i want to add data in this file.
    When i add data then data is added but i donnot get the previous data. What`s the problem of my code? Is there anyone can help me? how i will add data with the previous data? Please help me.
    String username=request.getParameter("UserName");
    String userage=request.getParameter("UserAge");
    String address=request.getParameter("UserAddress");
    String sex=request.getParameter("sex");
    FileWriter f = new FileWriter("d:\\download_dreamweaver\\Project_3\\WebContent\\SaveData.txt");
    f.append(username);
    f.close(); ith regards
    bina

    Looks like you're creating a new file (which overwrites the old one) every time. You need to open the file first and then append to it.

  • How to add date in XSLT?

    All,
    soa version: 11.1.1.4
    There is a requirement for me to add date to the current date in XSLT.  I searched in 'Data functions', there I couldn't find any pre-defined functions.  How do I achieve it in XSLT?  Any help is appreciated.
    thanks
    sen

    Hi Sen,
    You can do this using the below:
    <xsl:value-of select="xp20:add-dayTimeDuration-to-dateTime(xp20:current-dateTime(),'P1D')"/>
    You can change the P1D based on the number of days you want to add.
    For example 3 days = P3D
    Thanks,
    Deepak.

  • How to add data in xml file

    Hi ALL
    I want to add new fields on seeded EBS page to store their values in hr_api_transaction table whoch contain information of other fields on that page which are seeded
    but that table has one column which stores xml file and that xml file has all information about that page's fields
    how can I store my custom fields values in that xml file ?

    Hi,
    As Andy said,  add data to an xml file is overwriting, if you mean append data to xml file, please look this article:
    http://codesamplez.com/programming/linq-to-xml-tutorial, Since this issue is more related to ASP.net, you could also ask this issue in asp.net forum:
    http://forums.asp.net/
    Best Regards,
    Jambor
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to add data into JTable

    How can I add data into JTable, for instance ("Mike", "Gooler", 21).

    How can I add data into JTable, for instance ("Mike",
    "Gooler", 21).You will have very good results if you segregate out the table model as a seperate user class and provide a method to add a row there. In fact, if you use the table to reflect a database table you can add the row inplace using the existing cursor. I believe it's TableExample2 in the jdk\demo\jfc\TableExamples that has a very good example of this.
    Walt

  • How to add data

    hi everyone ! i have created a view object based on 2 entities objects (EMP and Departaments of hr schema)
    but i have also modified the sql query of the view in this way :
    SELECT Employees.EMPLOYEE_ID,
    Employees.FIRST_NAME,
    Employees.LAST_NAME,
    Employees.DEPARTMENT_ID,
    Departments.DEPARTMENT_NAME,
    Departments.DEPARTMENT_ID AS DEPARTMENT_ID1
    FROM EMPLOYEES Employees ,DEPARTMENTS Departments
    where Employees.DEPARTMENT_ID(+) = Departments.DEPARTMENT_ID
    and i have created a tables based on this view object..... in this table are shown those empl. that doesnt have departaments.... what i want to do is how can i add data to those rows wich doesnt have employess but have departaments???
    Thanks in advance :)

    Hi,
    I think you can resolve that problem using EL expression condition, try the following in your table:
    <af:table ...>
    <af:column headerText="#{bindings.EmployeeDepartment.labels.FirstName}"
    binding="#{backing_EmployeeDepartment.column2}" id="column2">
    <af:outputText value="#{row.FirstName!=null? row.FirstName: 'No Emp Found'}"
    binding="#{backing_EmpDept.outputText2}"
    id="outputText2"/>
    </af:column>
    </af:table>
    Regards,
    Ahmad Esbita

  • How to add data in related issue field in issue tracking list sharepoint 2013

    Hi,
    I'm using out of box Issue Tracking List. In Related Issue I want to add some data like :- Business, Technical, HR, Contractor etc in right side so user can select one of them add it. Not sure how to add these data in Related Issue column. Please advice.

    Related Issues is a lookup column to the same list which is Issue Tracking List. so you can add new items where title is Business, Technical, HR, Contractor etc then you will get those under related issues.
    My Blog- http://www.sharepoint-journey.com|
    If a post answers your question, please click Mark As Answer on that post and Vote as Helpful

Maybe you are looking for

  • Why does it freeze every time i download something??

    it never did this before until i updated to 12.0. now every time i try to download something the whole browser freezes up and i have to restart it. i already deleted the download.pdf or whatever file its called in my profiles and it still does it. it

  • Photoshop buttons with tranparent background display in IE 7 & 8 with a Black background

    I added Photoshop buttons to my website and they display fine in IE 9, but when I tested it on Windows XP using IE 8 and on Windows Server 2003 using IE 7 these Photoshop buttons showed up with black background where it should have been transparent.

  • Macbook pro boot camp

    Hi, I'm a new mac user. I try to install boot camp with Windows XP but I only have the cd which is OEM from my old Dell. Would it work? Someone please help. Thanks.

  • Activity planning error

    Hi All, I am facing a problem in KP26. I have defined a activity type and need to assign fixed price & variable price to the activity type. Accordingly i have assigned a fixed price for 10 HR & variable price  for 15 HR and the per hour rate is 25Rs/

  • Hard stuttering occurring in H.264 renders out of AE CS5

    Hi There, This problem just started ocurring, and I'm not sure how to troubleshoot the problem.  It may be related to some OSX upgrade, but it is incredibly annoying.  I have a 60 second animation with most of the source footage being Targa sequences