Rolling the date on in a specific format

Hello,
I want to output the date in the following format
yyyymmdd
I then want to add a certain number of days to the above date
Can anyone advise the best way to do this
Cheers
Mitch

The formatting of a Date is done with a DateFormat.
The date arithmetic is done with a Calendar.
These are two separate entities. They have nothing to do with each other.
So first you format the Date you have to your choosing.
Then you use a Calendar. Set the Calendar to the Date you had, then do the date arithmetic with the Calendar object. If you need another Date object to reflect the final result, use the getTime() method of the Calendar class.
Have a look at the Date, DateFormat, and Calendar API for more info.

Similar Messages

  • My Macbook pro was stolen 09/12, the police just returned it to me. I want to remove all the data and start over. Format the drive's etc. I have windows 7 on 1 partion and mountain lion OSX on the apple partition. How is the best way to do this?

    My Macbook pro was stolen 09/12, the police just returned it to me. I want to remove all the data and start over. Format the drive's etc. I have windows 7 on 1 partion and mountain lion OSX on the apple partition. How is the best way to do this?

    Have a look here...
    what-to-do-when-your-hard-drive-is-full.html

  • Loading the data from a packed decimal format file using a sql*loader.

    Hi ,
    In one of the project i'm working here i have to load the data into oracle table from a file using a Sql*loader but the problem is the data file is in the packed decimal format so please let me know if there is any way to do this....I search a lot regarding this ..If anybody faced such type of problem ,then let me the steps to solve this.
    Thanks in advance ,
    Narasingarao.

    declare
    f utl_file.file_type;
    s1 varchar2(200);
    s2 varchar2(200);
    s3 varchar2(200);
    c number := 0;
    begin
    f := utl_file.fopen('TRY','sample1.txt','R');
    utl_file.get_line(f,s1);
    utl_file.get_line(f,s2);
    utl_file.get_line(f,s3);
    insert into sampletable (a,b,c) values (s1,s2,s3);
    c := c + 1;
    utl_file.fclose(f);
    exception
    when NO_DATA_FOUND then
    if utl_file.is_open(f) then utl_file.fclose(f); ens if;
    dbms_output.put_line('No. of rows inserted : ' || c);
    end;SY.

  • Need to compare if a date belongs to a specific Format ...Any pointers ????

    Hi ,
    I have used the parse () method mentioned below , however it does not throw an exception or error when i enter date in an incorrect format (or format not mentioned in simpleDateFormat instance )and accepts any date format .
    For example , I expected a parse exception when i use dateStr3 which in 'MMddyyyy' format .
    String dateStr2 = "031208"; //MMddyy
    String dateStr3 = "03122008";//MMddyyyy
    try
    SimpleDateFormat simpleDateFormat = new SimpleDateFormat ("MMddyy");
    simpleDateFormat.setLenient(false);
    Date date2 = simpleDateFormat.parse(dateStr2);
    Date date3 = simpleDateFormat.parse(dateStr3);
    System.out.println( "Date String 2 is '"+date2 );
    System.out.println( "Date String 3 is '"+date3 );
    catch(ParseException pe){
    pe.printStackTrace();
    Any pointers please.

    It seems that the java.text.DateFormat class won't help you in this fashion.
    It can understand the date it seems. Interesting.
    I would keep it - it checks that you have got a valid date, and nobody has tried to put in the 35th of Octember or something stupid like that.
    On top of this, you could put a simple check for dateStr.length() == 6 to make sure it is the correct length.

  • Displaying the date in dd/mm/yyyy format

    Hi,
      In VC 7.1, Whenever the user selects the date from the calender it is displayed in mm/dd/yyyy format .but i want it to be displayed in dd/mm/yyyy format.please help me.
    Regards,
    Priya
    Edited by: priya on Oct 7, 2008 11:01 AM

    Hi
    Try using the DSTR Dynamic Expression function. Add a string field to your form or table and format it using the DSTR function.
    It should look something like "=DSTR(@CREAT_DATE,"DD/MM/YYYY")"
    You can find more information about date conversion functions in the [Date and Time Functions help page|http://help.sap.com/saphelp_nw70/helpdata/en/2b/6c37121f28462a8710c0c7493506dd/frameset.htm]
    Regards,
       Shai

  • Convert the date of string to datetime format 'MM/dd/yyyy' when the system date format is 'dd/MM/yyyy'.

    I need convert the date of string format 'MM/dd/yyyy' to datetime format 'MM/dd/yyyy' when the system date format is 'dd/MM/yyyy'.Since
    I need to search values based on date where my database datetime  is 'MM/dd/yyyy' format.

    In my opinion you should re-consider the assumption that the date picker returns a string. Maybe it is able to return a
    DateTime object directly instead of string. Then you will pass this value as a parameter of SQL query. This should work regardless of computer configuration.
    Otherwise, follow the previous string-based approaches.

  • How to get the date in 01-jan-2008 format

    hi
    how to get the date in 01-jan-2008 format

    Check this example of how to get this format..
    TABLES: T247.
    DATA: V_DATE TYPE SYDATUM.
    DATA: V_STRING(20).
    V_DATE = SY-DATUM.
    SELECT SINGLE * FROM T247
    WHERE SPRAS = SY-LANGU
    AND MNR = V_DATE+4(2).
    IF SY-SUBRC = 0.
    CONCATENATE V_DATE+6(2) '-' T247-KTX '-' V_DATE(4)
    INTO V_STRING.
    WRITE: / V_STRING.
    ENDIF.
    or
    make use of this FM
    CONVERSION_EXIT_IDATE_OUTPUT
    and see its documentation.
    or
    /: SET DATE MASK = 'DD-MMM-YYYY'
    &DATE&
    check with this.
    if it is not working try to give space between DD and MMM and YYYY
    all of the three work...choose whichever suits u
    eg2:
    Use FM:CONVERSION_EXIT_IDATE_OUTPUT
    Check this Program.....
    DATA:DATE TYPE D VALUE '20070912'.
    DATA:DATE2(12) TYPE C.
    DATA:FINAL_DATE(15) TYPE C.
    CALL FUNCTION 'CONVERSION_EXIT_IDATE_OUTPUT'
    EXPORTING
    INPUT = DATE
    IMPORTING
    OUTPUT = DATE2.
    CONCATENATE DATE20(2) '-' DATE22(3) '-' DATE2+5(4) INTO
    FINAL_DATE.
    WRITE:FINAL_DATE.
    Eg:3
    use FM MONTH_NAMES_GET by passing month_names-spras = 'E'
    it will return the Mont names in month_names-KTX ( 3 cha short name ) & month_names-LTX ( Long text ). then concatenate 'DD''-' month_names-KTX & 'YY'
    reward points if useful

  • I would like to programatically set the "Date Unused" on X Scale formatting for time plots.

    I can use the X Scale formatting on the front panel, but when I change from time to decimal using property nodes the "date" keeps showing up. How can I turn the date feature off so I just see Time in HH:MMS format?

    Disregard. I found the answer. Set the XScale.Format value to 6 (relative Time). feed in total seconds from start of day to the Xo, The reciprocal of data frequency to DeltaX, and set the decimal resolution to 3. This results in a time tagged plot showing just time (no Date).

  • Current date in JSP in specific format....

    I want to view the current date on a JSP in the format YYYY-MM-DD
    I know how to get the current date
    <%= new Date()%>
    But how can I get the current date in the format specified above.
    Any help please??

    Thanx leo_pruna! I got the answer and here it is for anyone whose interested.
    import 'java.util.*, java.text.*'
    <%
    Date today;
    String output;
    SimpleDateFormat formatter;
    formatter = new SimpleDateFormat("yyyy-MM-dd");
    today = new Date();
    output = formatter.format(today);
    %>
    And show it anywhere on your page like this...
    <%= output%>

  • Converting the DATE(yyyymmdd) into MONTH(yyyymm) format

    HAI
    I have one date InfoObject(ZDATE) in the format of YYYYMMDD format.
    My client wants another 'Month InfoObject(ZMONTH) in the format of YYYYMM . This ZMONTH infoobject should be derived from ZDATE.
    So please tell me how can i convert the ZDATE data into ZMONTH format.
    I think , it is possible by writing the ABAP code.
    Please give the ABAP CODE for converting the ZDATE data into ZMONTH format also .
    i wll assing the points
    bye
    rizwan

    Hi Rizwan,
    You can use offset like:
    zmonth = zdate+0(6)
    Zmonth is variable in which yyyymm is going to be stored
    and zdate is variable in which yyyymmdd is stored.
    I think this will slove your issue.
    Thanks=points

  • Cannot query on a date range (where the date is in a varchar format)

    Hi All
    Here is my SQL query:
    select unique(a.SAP_PO_NUMBER), a.ISSUE_CODE, a.PO_CREATION_DATE
    from sspe.vendor_purchase_order a
    where a.po_creation_date between to_date('2007-02-01', 'yyyy-mm-dd') and to_date ('2007-08-01', 'yyyy-mm-dd')
    and a.ISSUE_CODE like 'OK%'
    the po_creation_date field is a varchar(12) field and i get the following error:
    ORA-01861: literal does not match format string.
    Appreciate any help
    Gautam

    Try this
    <p><font face="Courier New" size="2">select <br>
    DISTINCT(a.SAP_PO_NUMBER),<br>
    a.ISSUE_CODE,<br>
    a.PO_CREATION_DATE<br>
    from <br>
    sspe.vendor_purchase_order a<br>
    where <br>
    TO_DATE(a.po_creation_date,'<DATE_FORMAT>')<br>
    between<br>
    to_date('2007-02-01', 'yyyy-mm-dd') and<br>
    to_date('2007-08-01', 'yyyy-mm-dd')<br>
    and <br>
    a.ISSUE_CODE like 'OK%'<br>
     </font></p>
    Good Luck

  • How to know the date you added a specific contact?

    Hi,
    Just wanted to knnow how to figure out when exactly i added a specific contact on my skype account...? I didn't find anything in the options etc...
    Please help!
    Thanks,
    Cha

    not sure if there's such option (I think there's none), you can try to contact customer service as they may be able to provide you with such info, here's how;
    How to Contact Skype Customer Service
    CONTACT SKYPE CUSTOMER SERVICE   |  HOW TO RECORD SKYPE VIDEO CALLS  | HOW TO HANDLE SUPICIOUS CALLS AND MESSAGES   |  WINDOWS PROBLEMS TROUBLESHOOTING   |  SKYPE DOWNLOAD LINKS  
    MORE TIPS, TRICKS AND UPDATES AT
    skypefordummies.blogspot.com

  • How to get the data converted in UTF-16 format  downloading(local&appl)

    Dear Freinds,
                     I have interface program when it is downloading on the desktop and application server some of the characters
    are not getting displayed properly ( eg : employee name) . Which is not getting downloaded correctly . This as an UTF 16 or not how to trace if. If this is an UTF issue how we can tackle this issue.
    Please could any body let me know , as iam not aware of solving UTF 16 isse.
    The issue given to me as below.
    for some personnel no.s their names are getting displayed as below
    11450113 = Hänggi
    11450117 = Hässig-Wehrli .
    Could any one let me know how can i approach this issue.
    thaks & regards

    check this link:[https://wiki.sdn.sap.com/wiki/display/ABAP/DownloadFileinUTF-8encoding]

  • Print the data on tc format

    hi experts,
    what is logic to print the data on tc(on excel) format , how can i extend the pages of tc format if the data have large no of records.
    can u sujjest me please!

    BI Publisher supports multi-column layout available in Word. Just go to Page Layout --> Page Suptup --> Columns --> Two.

  • ABAP Proxies to send the data to PI

    I have a scenario to send some data from ECC to Legacy system in flatfile format. I would like to use ABAP client proxies on the ECC side and File receiver adapter to tranmit the data to Legacy system.
    I tried various sample scenarios and know how to send simple data using ABAP report program(which triggers the client proxy from ECC).
    But the question is if I have to read SAP data files and send the data conditionally based on certain criteria to the other Legacy system. How do we write the ABAP code with in the ABAP Proxie program?  Can any body share the real time coding procedure to achieve this. I am not good at ABAP.
    I absolutely have good idea how we can configure on the receiver side.
    Thanks in advance.

    Hi
    If I want to transfer only specific data from various SAP database files from ECC and then triggering the ABAP client proxy in the ABAP report program
    There are various ways to do this. Create a class that can call reports(forms) for various legacy system say L1, L2 and L3. now create 3 reports each for the systems .
    In XI create a generic structure which can satisfy L1, L2 & L3 and generate the proxy for this structure.
    now in reports for L1 pass the data from ERP tables specific to L1 and use the client proxy report to pass the data to XI and deliver the flat file. Similarly for others you can do
    now at XI you do conditional receiver determination. Identify the condition from the payload that can distinguish L1, L2 & L3. based on this you can pass the data to defined receiver.
    Hope this helps.
    Thanks
    Gaurav

Maybe you are looking for