Dates And days

Hi Friends,
I am displaying current week dates(26/7/2004-1/8/2004) along with days(Mon-Sun)
The java code is as follows
import java.util.*;
import java.util.Date;
import java.text.*;
import java.util.Calendar;
class TryDate
public static void main(String args[])
Calendar calendar = new GregorianCalendar();
java.util.Date date=new java.util.Date();
calendar.setTime(date);
for (int i=0;i<7;i++)
if (i!= 0)
calendar.add(Calendar.DATE,1);          
System.out.println(calendar.get(Calendar.YEAR)+" "+calendar.get(Calendar.MONTH)+" "+calendar.get(Calendar.DAY_OF_MONTH)+" "+calendar.get(Calendar.DAY_OF_WEEK));
the point is that i am geting DAY_OF_WEEK as 1-7
i want is Mon-Sun
How to get it
Thanx
Pooja

You can make one function which return a name of day. Here is the code given, just execute it.
import java.util.*;
import java.util.Date;
import java.text.*;
import java.util.Calendar;
class TryDate
public static String getDay(int d)
     String day="Sun";
     switch(d)
          case 1:
                    day="Sun";
                    break;
          case 2:
                    day="Mon";
                    break;
          case 3:
                    day="Tue";
                    break;
          case 4:
                    day="Wed";
                    break;
          case 5:
                    day="Thu";
                    break;
          case 6:
                    day="Fri";
                    break;
          case 7:
                    day="Sat";
                    break;
     return day;
public static void main(String args[])
Calendar calendar = new GregorianCalendar();
java.util.Date date=new java.util.Date();
calendar.setTime(date);
for (int i=0;i<7;i++)
if (i!= 0)
calendar.add(Calendar.DATE,1);
System.out.println(calendar.get(Calendar.YEAR)+" "+(calendar.get(Calendar.MONTH)+1)+" "+calendar.get(Calendar.DAY_OF_MONTH)+" "+getDay(calendar.get(Calendar.DAY_OF_WEEK)));

Similar Messages

  • How to calculate Date and Days

    Hi BW Experts,
    I have requirement, I have field original GI Date and  it is calculating based on 'Original promise date'-'Transport time'. Formula is 'Original GI Date' = 'Original promise date'-'Transport time'.
    We are getting data for original promise date as Date format and  Transport time as Days (ex: 1 or 2 days).
    Here, how can I convert into Date or how can I calculate Date and Days. I am working on BW3.5 .
    Please help me how can I overcome this requirement.
    Points will be assign.
    regards
    Yedu.

    Hi Ventatesh
    It's not a problem
    You can subtract days from date to get the resultant date
    Original Promise time  =  GI Date  - Transit time ( in days)
    Add Original Promise Time in your data target and fill that up with the above rule.
    If the above is not working you can use this function module
    DATE_IN_FUTURE
    Here you need to pass Date and Days to get future date. Only trick you need to apply that if the transit days is 5 days, you pass -5 to this function module.
    But this function module is not available in BW system. Just copy the code from ECC system and create a Z FM for BW system
    Regards
    Anindya
    Edited by: Anindya Bose on Feb 9, 2012 4:36 AM

  • Date and Days for all year come in column

    Dear all
    I have 2 Column 1 is Date and 2nd is Day
    And i have one Button i need when i enter button then its show all year date in date column and day in day column for example
    Date---------Day+
    *1-jan-2009-Thursday*
    *2-jan-2009-Friday*
    *3-jan-2009-Saturday*
    And As on
    I hope you guys understand
    Regards
    Shahzaib ismail

    Hai,
    That means, You need to fill the multi record block which has 2 columns ( 1 is date, and the other is day.).
    For that Try this in the WHEN-BUTTON-PRESSED Trigger of the Button.
    DECLARE
         Dt_Date DATE;
    BEGIN
         GO_BLOCK ('<block_name>');
         CLEAR_BLOCK(NO_VALIDATE);
         FIRST_RECORD;
         Dt_Date := TO_DATE('01-JAN-2009');
         LOOP
              :<block_name>.TI_DATE := TO_CHAR(Dt_Date, 'DD-MON-YYYY');
              :<block_name>.TI_DAY  := TO_CHAR(Dt_Date, 'DAY');
              EXIT WHEN TO_CHAR(Dt_Date, 'YYYY') <> TO_CHAR(Dt_Date + 1, 'YYYY');   -- If next year reaches, exit from the loop.
              Dt_Date := Dt_Date + 1;
              NEXT_RECORD;
         END LOOP;
    END;          Regards,
    Manu.
    If this answer is helpful or correct, please mark it. Thanks.

  • Dates and days do not match

    When i go on Ical to set an event and click go to today it brings me automatically to July 2554.
    If i change to manual date like today july 12 2011, it shows it as a june 12th and the wrong day it should be
    If i go to next month July, it shows the 12 being a thursday ???
    How can i reset it right

    Sylvain,
    If you are using Snow Leopard, go to System Preferences...>Language & Text>Formats>Region: and set/re-set the appropriate Region.

  • Function Modules on date and day.

    I need to calculate the date of the following Sunday based upon the current date.Could you suggest how to go calculate the same and if there are any function modules to do the same.

    HI sandeep this will give u the best results....
    parameters:
      p_date like sy-datum ." here u give the required date
    data:
      w_date1 type i,
      w_mod type i.
      w_date1 = p_date.
    *  write: / p_date1.
      w_mod = w_date1 mod 7.
      write: / w_mod.
      if w_mod ne 0.
        w_date1 = w_date1 + ( 7 - w_mod + 1 ).
      else.
        w_date1 = w_date1 + 1.
      endif.
      move w_date1 to p_date.
      write: / 'the following sunday is ',p_date.
    I hope it will helps u..
    if helps reward with points..
    Regards Rk..
    null

  • Displaying date and day

    Hi all
    Can anybody help me how to display the system date in the following format
    "dd-mm-yyy" "day"

    Hello,
    Try this program below:
    import java.util.Date;
    import java.text.SimpleDateFormat;
    class DateCheck
         public static String stringConvert(Date date)
              String expDate=null;
              try {
              String MY_DATE_FORMAT =" \"dd-MMM-yyyy\" \"EEE\"";
              expDate = new SimpleDateFormat(MY_DATE_FORMAT).format(date);
              } catch(Exception e) {
              e.printStackTrace();
              return expDate;
         public static void main(String[] args)
              Date d = new Date();
              System.out.println(stringConvert(d));
    }

  • Query on fetching the no.of days between Invoice date and due date in rtf template embedded BI Publisher Report

    Hi Experts,
    We have a requirement to fetch the value of 'No of days' between Invoice date and due date (Two variable date fields on the template) in an Analysis.
    Please let me know the procedure of how to achieve the same.
    Regards,
    Rev

    it's good for ideas but implementation a bit different
    Oracle Business Intelligence Publisher Report Designer's Guide
    This function provides a method to get the difference between two dates in the given locale. The dates need to be in "yyyy-MM-dd" format. This function supports only the Gregorian calendar. The syntax is as follows:
    <?xdoxslt:date_diff(‘format’, ‘YYYY-MM-DD’, ‘YYYY-MM-DD’, $_XDOLOCALE, $_XDOTIMEZONE)?>
    where
    format is the time value for which the difference is to be calculated
    Example:
    <?xdoxslt:date_diff(‘d’, ‘2006-04-08’, ‘2006-04-01’, $_XDOLOCALE, ‘America/Los_Angeles’)?>
    returns
    -7

  • Keyboard shortcuts: current day and date, and current time?

    I would like to know keyboard shortcuts for entering current day and date, and current time (separated entries) in Numbers. Something that Excel does easily. Thank you, Ian

    Ian,
    Numbers does not have predefined key command for Insert Date & Time as you can see from this screenshot:
    All menus show the key commands on the very right (if there is a ke command).  You can add you own, custom, key commands by opening system preferences and selecting the Keyboard panel, then the "Keyboard Shortcuts" segment:
    Click the "+" then a modal dialog will appear.   Select the application from the pop, then enter the exact name if the menu item, and, finally, your desired key combination:
    You can do this for any application

  • How to enter a new Date and Time each day in a Numbers Spreadsheet...

    Hi... I have finally decided to move away from Excel and really give Numbers a shot... I have an application where each day I first enter the current date and time into a particular cell of a new row and then I enter some data in cells adjacent (in the same row) as that entered date-time. Then the next day I want to again enter the (new) current date and time and add more data next to that new date-time and so forth day after day... You can't use something as simple as =NOW() because then everyday, ALL of the date-times would change to the current time... Nope, now what I want... I just want to be able to EASILY and QUICKLY enter the current date-time value in one call and then have that specific value stay there forever... In Excel, this is accomplished with the keyboard shortcuts of
    <cntl> followed by a semicolon (;) for the date
    then enter a single space (for separation of date versus time) followed last by
    <command> followed again by a semicolon...
    So all together that is,
    <cntl><;><sp><command><;>
    and that puts something like
    4/10/2010 9:49:00 AM
    in a single cell...
    That's what I now want to be able to do in Numbers...
    How do I do that??? Do I use the menubar item "Insert Date and Time" and if so, how exactly do I get the current time to show up in the chosen cell??? With formatting??? Is there a keyboard shortcut method like the one I mentioned that works for Excel?? I've perused the manual and though I found lots on date-time, I didn't see how to do specifically what I want to do... I likely just missed it as surely it must be easy to do...
    Any feedback would be much appreciated... thanks... bob...

    Badunit wrote:
    The result of running that script is "UI Enabled = TRUE".
    I have cells named by the header values.
    This may be the problem.
    The script is an old one which deciphered only the letter+digit cell references.
    Here is a new version which works with every kind of cell reference.
    --[SCRIPT insertDateTime]
    Enregistrer le script en tant que Script : insertDateTime.scpt
    déplacer l'application créée dans le dossier
    <VolumeDeDémarrage>:Users:<votreCompte>:Library:Scripts:Applications:Numbers:
    Il vous faudra peut-être créer le dossier Numbers et peut-être même le dossier Applications.
    Placez le curseur dans la cellule qui doit recevoir la date_heure
    menu Scripts > Numbers > insertDateTime
    La cellule pointée reçoit la date_heure.
    L'aide du Finder explique:
    L'Utilitaire AppleScript permet d'activer le Menu des scripts :
    Ouvrez l'Utilitaire AppleScript situé dans le dossier Applications/AppleScript.
    Cochez la case "Afficher le menu des scripts dans la barre de menus".
    +++++++
    Save the script as a Script : insertDateTime.scpt
    Move the newly created application into the folder:
    <startup Volume>:Users:<yourAccount>:Library:Scripts:Applications:Numbers:
    Maybe you would have to create the folder Numbers and even the folder Applications by yourself.
    Put the cursor in the cell which must receive the date_time.
    menu Scripts > Numbers > insertDateTime
    The pointed cell receives the current date_time.
    The Finder's Help explains:
    To make the Script menu appear:
    Open the AppleScript utility located in Applications/AppleScript.
    Select the "Show Script Menu in menu bar" checkbox.
    Yvan KOENIG (VALLAURIS, France)
    2009/03/01
    2010/04/11 is now able to treat every kind of cell references
    property theApp : "Numbers"
    --=====
    on run
    set {dName, sName, tName, rname, rowNum1, colNum1, rowNum2, colNum2} to my getSelParams()
    my doYourDuty(colNum1, rowNum1, tName, sName, dName)
    end run
    --=====
    on doYourDuty(c, r, t, s, d) (*
    c = columnIndex
    r = rowIndex
    t = table's name
    s = sheet's name
    d = document's name *)
    local cdt
    set cdt to my cleanThisDate(current date) (* the new date_time as a clean date_time *)
    tell application "Numbers" to tell document d to tell sheet s to tell table t
    set value of cell r of column c to cdt as text
    end tell -- application …
    end doYourDuty
    --=====
    on cleanThisDate(dt)
    (* ugly code but once I got date_time with milliseconds so if necessary, I drop them *)
    local l
    set l to my decoupe(dt as text, ":")
    if (count of l) > 3 then set dt to date (my recolle(items 1 thru 3 of l, ":"))
    return dt
    end cleanThisDate
    --=====
    on getSelParams()
    local r_Name, t_Name, s_Name, d_Name, col_Num1, row_Num1, col_Num2, row_Num2
    set {d_Name, s_Name, t_Name, r_Name} to my getSelection()
    if r_Name is missing value then
    if my parleAnglais() then
    error "No selected cells"
    else
    error "Il n'y a pas de cellule sélectionnée !"
    end if
    end if
    set two_Names to my decoupe(r_Name, ":")
    set {row_Num1, col_Num1} to my decipher(item 1 of two_Names, d_Name, s_Name, t_Name)
    if item 2 of two_Names = item 1 of two_Names then
    set {row_Num2, col_Num2} to {row_Num1, col_Num1}
    else
    set {row_Num2, col_Num2} to my decipher(item 2 of two_Names, d_Name, s_Name, t_Name)
    end if
    return {d_Name, s_Name, t_Name, r_Name, row_Num1, col_Num1, row_Num2, col_Num2}
    end getSelParams
    --=====
    set {rowNumber, columnNumber} to my decipher(cellRef,docName,sheetName,tableName)
    apply to named row or named column !
    on decipher(n, d, s, t)
    tell application "Numbers" to tell document d to tell sheet s to tell table t to return {address of row of cell n, address of column of cell n}
    end decipher
    --=====
    set { d_Name, s_Name, t_Name, r_Name} to my getSelection()
    on getSelection()
    local _, theRange, theTable, theSheet, theDoc, errMsg, errNum
    tell application "Numbers" to tell document 1
    repeat with i from 1 to the count of sheets
    tell sheet i
    set x to the count of tables
    if x > 0 then
    repeat with y from 1 to x
    try
    (selection range of table y) as text
    on error errMsg number errNum
    set {_, theRange, _, theTable, _, theSheet, _, theDoc} to my decoupe(errMsg, quote)
    return {theDoc, theSheet, theTable, theRange}
    end try
    end repeat -- y
    end if -- x>0
    end tell -- sheet
    end repeat -- i
    end tell -- document
    return {missing value, missing value, missing value, missing value}
    end getSelection
    --=====
    on decoupe(t, d)
    local l
    set AppleScript's text item delimiters to d
    set l to text items of t
    set AppleScript's text item delimiters to ""
    return l
    end decoupe
    --=====
    on parleAnglais()
    local z
    try
    tell application theApp to set z to localized string "Cancel"
    on error
    set z to "Cancel"
    end try
    return (z is not "Annuler")
    end parleAnglais
    --=====
    --[/SCRIPT]
    It's available on my idisk :
    <http://public.me.com/koenigyvan>
    Download :
    For_iWork:iWork '09:for_Numbers09:insertDateTime.zip
    Yvan KOENIG (VALLAURIS, France) dimanche 11 avril 2010 14:16:41

  • How to derive date from given month, year and day?

    Hi all,
    I have a doubt in date function. I need to create a date from the given month, year and day. How can i do it?

    consider this example
    REPORT zconvertdate001 .
    TYPES : BEGIN OF tt_date_in,
            day(2),
            sep1,
            month(3),
            sep2,
            year(4),
            END OF tt_date_in.
    DATA : wa_date_in TYPE tt_date_in VALUE '07-Jul-2006'.
    TYPES : BEGIN OF tt_date_out,
            day(2),
            month(2),
            year(4),
            END OF tt_date_out.
    DATA : wa_date_out TYPE tt_date_out.
    TRANSLATE wa_date_in-month TO UPPER CASE.
    SELECT SINGLE mnr
    INTO wa_date_out-month
    FROM t247
    WHERE spras EQ sy-langu
    AND   ktx EQ wa_date_in-month.
    CONCATENATE wa_date_in-year wa_date_out-month wa_date_in-day
           INTO wa_date_out.
    WRITE : / ' Date in:', wa_date_in,
            / 'Date out:', wa_date_out.

  • HT1418 I have iPod4 and cannot see day-to-day appointments, etc on PC Outlook calendar.  Only repeated items (birthdays, anniversaries, etc.) are visible.  Where is the rest of my data and how do I restore it to the only calendar I have in Outlook?

    I have iPod4 and cannot see day-to-day appointments, etc on PC Outlook calendar.  Only repeated items (birthdays, anniversaries, etc.) are visible.  Where is the rest of my data and how do I restore it to the only calendar I have in Outlook?
    Thanks

    Hello Schimi. The Time Capsule is a kind of product that offer you two possibility:
    - To use the TC as a router or as an external HD.
    The difference between WPA and WPA 2 are:
    - They are two kinds of internet connection.
    WPA uses dynamic key encryption , which means that the key is constantly changing and makes the invasion of a wireless network more difficult than WEP . WPA is considered one of the highest levels of wireless security for your network and is recommended if your devices support this kind of encryption . Newer routers offer WPA2 security . WPA2 is compatible with WPA , but offers higher security level . In fact, it meets the high standards of many government agencies . If the router and computer support WPA2 , this should be your choice.
    If you need any help or if you find some difficult setting up it you can contact Apple Support.
    I am sure that they can help you with that.
    I am sory for the delay. I holpe that you solve your issue.

  • I am looking for a timer that shows elapsed time since a particular date and time.  Showing days, hours, minutes etc.

    I would like to download an application for my desktop and maybe even my iphone that will tell me how many days, hours, minutes, etc have elapsed since a particular date.
    For example, my brother just had a baby and I want to put that date and time into the app and then determine how long it has been since that date and time.
    Hopefully this makes sense, because I have not been able to locate anything.
    Thanks in advance,

    This is fantastic.  Thank you.
    Is there any way to have something like this displayed on my desktop showing the time as it ticks away?

  • Adding one day to a oracle.jbo.domain.Date and truncating the time part

    JDev 11.1.1.4.0
    Hello
    I need to add a day to oracle.jbo.domain.Date and get back a oracle.jbo.domain.Date without the time part.
    So far I've got
    Date valueDate = (Date)rowCpt.getAttribute("ValueDate");                                       
    Calendar cal = Calendar.getInstance();
    cal.setTime(new java.util.Date(valueDate.timestampValue().getTime()));
    cal.add(Calendar.DATE, 1);
    Date newDate = new oracle.jbo.domain.Date(new Timestamp(cal.getTime().getTime()));This adds 1 day to the date but keeps the time part of the date.
    How do I get rid of the time part of the date ?
    Thanks
    Paul

    The Calendar class allows you to set or clear each field.
    Date valueDate = (Date)rowCpt.getAttribute("ValueDate");                                       
    Calendar cal = Calendar.getInstance();
    cal.setTime(new java.util.Date(valueDate.timestampValue().getTime()));
    cal.add(Calendar.DATE, 1);
    cal.clear(Calendar.HOUR);
    cal.clear(Calendar.MINUTE);
    cal.clear(Calendar.SECOND);
    cal.clear(Calendar.MILLISECOND);
    Date newDate = new oracle.jbo.domain.Date(cal.getTimeInMillis());should work.
    Timo

  • Acrobat Pro XI transposes numbers for month and day in dates when saving optimized pdf to Excel spreadsheet.

    Using Adobe Acrobat Pro XI and Excel 14.3.8 on a mac. 
    Saved PDF as "optimized PDF" then "save as other" > spreadsheet > Microsoft Excel Workbook.
    Problem: numbers in some random dates are  transposed so that month and day are reversed.  No particular pattern to these errors.  Only fix we've found is to go through and manually check and correct the date errors - there are hundreds of these errors in the document so this is not a good solution.
    (Note: Excel columns with dates are specified as "date" fields. All dates are formatted as m/d/yy)
    Any ideas what's causing this problem problem and how to fix it? 
    Thanks in advance!

    [discussion moved to Creating, Editing & Exporting PDFs forum]

  • Difference between Posting Date and Posting Day

    In Accounting Document Header table BKPF, there are 2 fields: BUDAT (Posting Date) and PSOBT (Posting Day), both of DATS type. What is the difference between the two?
    Why is that substitutions and Business Transaction Events allow changing of Posting Day (PSOBT) and not BUDAT (Posting Date)?
    In that case, how can I change the Posting Date of a document based on certain rules?
    Thank you.

    Hi,
    13 period is a special accounting period, so the situation you described is perfectly normal. The reversal document will be posted in the same period.
    You can read more about special periods here:
    http://help.sap.com/erp2005_ehp_03/helpdata/EN/96/8b2fef43ce11d189ee0000e81ddfac/frameset.htm
    Regards,
    Eli

Maybe you are looking for