Datechooser display current date in YYYY/MM/DD format on init

I have two date fields. I'd like one date chooser to display
the current date on creation complete and the other should display
the 30 days after the current date.
The format needs to be YYYY/MM/DD.
I'm currently getting a the current date in a var called
currentDate but it returns at 11 Dec 2008.
Thanks in advance.
I

Thanks,
I am using : <mx:DateField id="effective_date"
formatString="YYYY/MM/DD"
text="{dgMessages.selectedItem.effective_date}" showToday="true"
enabled="true"/>
so after the user chooses a dates everything is fine.
The customer wants todays date to already be populated in the
datefield when the application loads and that's where I have my
problem.
I get my current date:
var currentDate:Date = new Date();
but I need to format that date from 12 Dec 2008 to 12/12/2008
and create another date var called endDate adding 60 days.
I assume I must convert this vars to strings since I get an
error when attempting to display them in the datafield.
I hope I explained that well enough.

Similar Messages

  • Formatting a date in YYYY-MM-DD format in a grid in We dynpro abap

    Hi All,
    I have the requirement to display a date in YYYY-MM-DD format in a salv_wd_table grid .
    when i selecting the date from the calender that attached to a column in the grid will show in DD-MM-YYYY format.
    Please help in this.

    >
    Manoj Kumar wrote:
    > Hi Abhimanyu  ,
    >
    > I don't want like that.
    > Iwant to know is there any other way apart from this or any property to set the format of a column in salv grid.
    ABAP is pretty good about automatically using the user's profile settings for formatting. That enforces consistency across applications.  If you want to override this, you will need to do it at the data level.  Instead of defining this field in the context as a data - define it like a string or char10.  Then when you populate the data within your business logic do a WRITE statement from the data field to the character field.  During the WRITE command you can specify the date formatting option:
    From the online syntax of WRITE:
    Addition 15
    ... DD/MM/YY   | MM/DD/YY
      | DD/MM/YYYY | MM/DD/YYYY
      | DDMMYY     | MMDDYY
      | YYMMDD
    Effect: These additions influence the output of data objects of the data type d. In all other data types, the addition is ignored.
    The content of a data object of type d is interpreted as a valid date in the format YYYYMMDD and is output as follows for the individual additions:
    DD/MM/YY and MM/DD/YY:
    Both additions have the same effect. The date output has a two-digit year value and a separator. The separator and the order are taken from the definition for date output in the user master record.
    DD/MM/YYYY und MM/DD/YYYY:
    Both additions have the same effect. The date output has a four-digit year value and separator. The separator and the order are taken from the definition for date output in the user master record.
    DDMMYY und MMDDYY:
    Both additions have the same effect. The date output has a two-digit year value and no separator. The order is taken from the definition for date output in the user master record.
    YYMMDD:
    This addition provides a date output with a two-digit year value without a separator in the format YYMMDD.
    But even this approach is going to have limited impact. It will only let you chose between the allowed formatting types from the user master.  YYYY-MM-DD is not one of those formats.
    So if you really want a non-SAP formatted date you will have to break it up yourself.  The internal date format is always stored as YYYYMMDD. You can just parse it out:
    data year type char4.
    data month type char2.
    data day type char2.
    year = sy-datum+0(4).
    month = sy-datum+4(2).
    day = sy-datum+6(2).
    data date_string type char10.
    concatenate year `-` month `-` day into date_string.

  • How to display current date in query header?

    Hi,
    How to display current date in query header?
    I use Query Designer for development.
    Thanks,
    Arun KK

    Hi Arun,
    You can define fixed header lines and footer lines so that when you generate the query list, they can receive current values of certain fields. When you define a header line or a footer line, you must specify a character string of the type &field, where field is the short name of a field.
    This function allows you (for example) to place a sort criterion in the header line.
    You can include the following fields as variables in the headers directly:
    %NAME
    Name of the user processing the query
    %DATE
    Current date
    %TIME
    Current time
    %PAGE
    Current page number (6 characters)
    %P
    Current page number (3 characters)
    These fields can be used in the short forms N,D,T and P. If you want to use these letters as short names for query fields, the field values from the query are used.
    You can also see the link
    [http://help.sap.com/saphelp_nw70/helpdata/EN/6e/dd68721faf11d6b1d500508b6b8b11/frameset.htm]
    Regards,
    NR

  • HOW TO DISPLAY CURRENT DATE TIME IN MASTHEAD IN BRANDING IMAGE AREA

    Hi experts,
    I need to display current date time in masthead also and also i should change the welcome area to my own text there how it is possible.....
    and plz tell detail coding also as i dont have idea to change the coding plz help in this............
    where to chan ge and how to change.............
    waiting for u r responses......................
    Regards,
    Shilpa.

    Shilpa,
    go to system administratioon-system configuration-support-support desk-browse deployment-check for com.sap.porta.navigation.masthead.par and download it to nwds.
    when you import it to NWDS jar file will be missing so you need to manually add that to PORTAL-INF/private/lib.
    once you do this go to HeaderiView.jsp in PORTAL-INF/jsp folder.
    write
    <%= new java.util.Date()%> after <hbj:form id="HeaderForm">.for that matter u can write this at any line after this statement
    once you do that select qucik par upload from the tool bar and deploy it.
    go to system administration-system configuration-support-support desk-administration console and upload the par file
    before following these steps take a backup of par file
    reward points if helpful

  • How to convert JAVA.SQL.DATE date in YYYY/MM/DD format into DD/MM/YYYY

    i am using informix database which accepts date value in the form of DATE format......
    the other part of my application takes date from the field in DD/MM/YYYY format...so i have to convert my java.sql.date in YYYY/MM/DD fromat into DD/MM/YYYY fromat of same type before inserting into db......
    but using parse method in SimpleDateFormat class can get the result only in java.util.date format...
    and also using format method can result only in string conversion........

    816399 wrote:
    i am using informix database which accepts date value in the form of DATE format......Huh?
    Maybe you mean Informix (fronted by JDBC) expects date values as java.sql.Date objects?
    the other part of my application takes date from the field in DD/MM/YYYY format...
    so i have to convert my java.sql.date in YYYY/MM/DD format into DD/MM/YYYY format of same type before inserting into db......I am not sure why you are talking about formats here.
    There is no formatting inherent in a java.util.Date object
    nor in a java.sql.Date object.
    but using parse method in SimpleDateFormat class can get the result only in java.util.date format...
    and also using format method can result only in string conversion........You can easily create a java.sql.Date object from a java.util.Date object.
    String s = "31/12/2010";
    java.util.Date ud = new java.text.SimpleDateFormat("dd/MM/yyyy").parse(s);
    java.sql.Date sd = new java.sql.Date(ud.getTime());
    ud = sd; // java.sql.Date extends java.util.Date so no conversion is needed

  • Convert a String Mar 7, 2008 to date in yyyy-dd-mm format

    Hi,
    Please help me to Convert a String Mar 7, 2008 to date in yyyy-dd-mm format..
    have to store that Date in SQL Server date field in yyyy-dd-mm.
    Regards,

    I done this and got the desired result 2008-03-07. Thanks... know checking it with my code :)
    String ss = "Mar 7, 2008";
              //System.out.println(ss);
              try{
              SimpleDateFormat dateFormat = new SimpleDateFormat("MMM dd, yyyy");
              Date date = dateFormat.parse(ss);
              System.out.println(date.toString());
              System.out.println(new java.sql.Date(date.getTime()));
              }catch(Exception ee)
                   ee.printStackTrace();
              } //endsEdited by: bunty_india on May 8, 2008 8:09 PM

  • Can we configure Oracle 10g xe so that it accept date in yyyy-mm--dd format

    I am facing problem in inserting and updating data in oracle server through jdbc. its java.sql.Date class sends date in yyyy-mm-dd format while oracle requires date in dd-mmm-yy format. can we configure oracle server in such a way that we may send date in yyyy-mm-dd format to insert and update?

    People should be sure of their information before
    posting, even more so if they have an Oracle Ace
    credential,as they're more likely to be believed. Not sure what you are saying.
    The way I read it, Avi stated that overriding the NLS_DATE_FORMAT as an initialization parameter WILL NOT affect the way XE works, and you still need to set the parameter at the session level.
    This is true.
    As demonstrated here, where I
    - startup my XE (SuSE 10.1 Pro/Linux),
    - show the NLS setting,
    - log on to a regular user, -
    - show the system date,
    - change the NLS_DATE_FORMAT system wide by updating my PFILE,
    - restart the database
    - show the NLS_DATE_FORMAT
    - extract the system date.
    As you see from the console session, the date still comes out in the format defined by the NLS_TERRITORY, in spite of what the global NLS_DATE_FORMAT indicates.
    fcc@fuzzy:~> su - oracle
    Password:
    oracle@fuzzy:~> sqlplus / as sysdba
    SQL*Plus: Release 10.2.0.1.0 - Production on Fri Jul 6 08:06:05 2007
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    Connected to an idle instance.
    SQL> startup
    ORACLE instance started.
    Total System Global Area  448790528 bytes
    Fixed Size                  1259400 bytes
    Variable Size             134219896 bytes
    Database Buffers          310378496 bytes
    Redo Buffers                2932736 bytes
    Database mounted.
    show parameter nls_date
    Database opened.
    SQL>
    NAME                                 TYPE        VALUE
    nls_date_format                      string
    nls_date_language                    string
    SQL> connect test/test
    Connected.
    SQL> select sysdate from dual;
    SYSDATE
    06-JUL-07
    SQL> alter session set nls_date_format='YYYY Mon DD';
    Session altered.
    SQL> select sysdate from dual;
    SYSDATE
    2007 Jul 06
    SQL> connect / as sysdba
    Connected.
    SQL> select sysdate from dual;
    SYSDATE
    06-JUL-07
    SQL> create pfile='/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/xe.pfile' from spfile;
    File created.
    SQL> !vi /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/xe.pfile
    SQL> shutdown immediate
    Database closed.
    Database dismounted.
    ORACLE instance shut down.
    SQL> startup pfile=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/xe.pfile
    ORACLE instance started.
    Total System Global Area  448790528 bytes
    Fixed Size                  1259400 bytes
    Variable Size             134219896 bytes
    Database Buffers          310378496 bytes
    Redo Buffers                2932736 bytes
    Database mounted.
    Database opened.
    SQL> connect test/test
    Connected.
    SQL> connect / as sysdba
    Connected.
    SQL> show parameter nls_date
    NAME                                 TYPE        VALUE
    nls_date_format                      string      YYYY Mon DD
    nls_date_language                    string
    SQL> connect test/test
    Connected.
    SQL> select sysdate from dual;
    SYSDATE
    06-JUL-07
    SQL>                                                            

  • Unable to get date in yyyy.MM.dd format

    Hi All
    I am unable to get date in yyyy.MM.dd format.
    I tried everything said in the previous postiongs.Nothig seem to work.
    I am getting date in yyyy-MM-dd
    This needs to be changed in said format. Also datatype should be date only.
    Regards
    Pratyush

    You can solve the problem in two ways
    First way;
    Format formatter = new SimpleDateFormat("yyyy.MM.dd");
    String s = formatter.format(date);
    OR
    Assuming your context attribute name is Date
    IWDAttributeInfo attributeInfo = wdContext.getNodeInfo().getAttribute("Date");
    attributeInfo.getDataAttribute().getScalarType().format("yyyy.MM.dd");
    Second way;
    By changing the default Language of your browser. You have to check the format of each language and choose the language that gives the date in yyyy.MM.dd format.
    Rgs,
       Dni

  • Want date into  'yyyy/mm/dd' format

    Hi
    all
    Im creating date onject like
    Date d = new Date();
    but date object d is availabe with date and time.
    i want to exctract date into 'yyyy/mm/dd' format.
    can anybody helpe in this case
    Help will be appricated.
    Thanx
    sanjay

    You are hereby served with notice of a hearing to be held in 18th Circuit Court of Seminole County, FL, on 12 April 2005 to answer a suit brought against you for spoon-feeding. You have 15 days upon receipt of this notice to provide written response to the original filing (see Attachment A).
    � {�                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Want Date in 'yyyy/mm/dd' Format

    Hi
    all
    Im creating date onject like
    Date d = new Date();
    but date object d is availabe with date and time.
    i want to exctract date into 'yyyy/mm/dd' format.
    can anybody helpe in this case
    Help will be appricated.
    Thanx
    sanjay

    Hi
    Try this:
    SimpleDateFormat time = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
    time.format(new Date()

  • Displaying Current Date and Time in JSP

    Hi,
    I need to insert the current date time in Ms SQL Server Database using jsp page. The format of the code willbe
    insert into table(update_date) values ('2007-01-01 10:02:21');
    But i am not getting how to display the current date and time ie. 2007-01-01 10:02:21 using jsp.
    I have tried using
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    GregorianCalendar cal = new GregorianCalendar();
    String dd = sdf.format(cal.getTime());
    insert into table(update_date) values (dd);
    But it didnot get inserted data.
    Can anybody figure out with simple ideas.
    Thank You

    Why then are you trying to insert the current date on a table?
    To show the current date on the JSP you might try
    <%=new Date()%>Or the way you had it on your first post with the date formatter and then use the <%=%> tags. Anyway, it seems to me I'm not really understanding what you actually want to do :-p
    P.S. NOW() is a MySQL function too, not only MSSQL server (didn't even know it had it too ;-))
    mysql> insert into a(up) values (now());
    Query OK, 1 row affected (0.00 sec)
    mysql> select * from a;
    +------------+
    | up         |
    +------------+
    | 2007-04-09 |
    +------------+Message was edited by:
    benubach
    Message was edited by:
    benubach

  • Display Current Date on Heading Title (TTITLE)

    I am using sql*plus to write a report. I would like for the current date (and time if possible) to be displayed in the title of my report (TTITLE.) It appears that I'm supposed to use a system variable called, _DATE, but I'm not sure what to do.  I'm running sql*plus v.10.2.
    Here is my code. How can I include the current date to be displayed in the "RIGHT" side of the TTITLE heading?
    TTITLE ON
    TTITLE LEFT 'MY COMPANY' CENTER 'Weekly Invoice Totals for Cost Center: 10 - MANAGEMENT' RIGHT 'Date: '
    set pagesize 66
    set linesize 120
    set wrap off
    column vendor_name heading 'Supplier' format a40
    column invoice_num heading 'Invoice Number' format a30
    column invoice_amount heading 'Invoice Amount' format 999,999,999.99
    set underline =
    compute sum label TOTAL of invoice_amount on vendor_name
    break on vendor_name skip 2
    SELECT
    po_v.vendor_name,
    ap_inv.invoice_num,
    ap_inv.invoice_amount,
    FROM
    ap.ap_invoices_all ap_inv,
    po.po_vendors po_v,
    WHERE
    ap_inv.vendor_id = po_v.vendor_id and
    ap_inv.creation_date > SYSDATE-10;

    Hi,
    Define a substitution variable, then use that variable in your TTITLE statement:
    COLUMN     report_date_col     NEW_VALUE  report_date
    SELECT     TO_CHAR ( SYSDATE
              , 'DD-Mon-YYYY'
              )     AS report_date_col
    FROM     dual
    TTITLE LEFT 'MY COMPANY' CENTER 'Weekly Invoice Totals for Cost Center: 10 - MANAGEMENT' RIGHT 'Date: &report_date' SQL*Plus can't execute functions (like SYSDATE).
    To get function results into a substitution variable, you can use the COLUMN ... NEW_VALUE command, as shown above, then call the function in a query.
    Note that both the substitution variable and the title are static. That is, if you include the hours-minutes-seconds in the format, and run the SELECT statement at 17:00:00, then execute the TTITLE command at 17:00:05, and run reports at 17:01:00, 17:02:00 and 17:03:00, the title on all the reports will say 17:00:00.

  • How to set Default value of a parameter  to display Current Date

    I need to display the Default value for my parameter 'As of Date' which is of datatype Date as Current Date[DD-MON-YYYY].
    How can I do This??

    As Tamir-L pointed out, there is no direct way to do this, but there is a workaround:
    First, create a new parameter, but do not base it on any item. Give the parameter a default value of "Today".
    Then, create a condition like:
       (    :myParam = 'Today'
        AND <date_item> = sysdate)
    OR (    <date_item> = to_date(:myParam, 'DD-MON-YYYY'))Where :myParam is the parameter you created, and <date_item> is the item you are comparing against.
    To make things a bit more bulletproof, you could create a calculation that returns sysdate when the parameter is 'Today', a date when the to_date is successful, and NULL when the to_date fails, and use the calculation in the condition.

  • Display current date in jsp?

    I hate asking for code, but I can't find anything on this. I'm trying to display the current date in the format YYYYMMDD on a jsp page without using scriplets. I've seen getting the time in milliseconds used through
    <jsp:useBean id="now" class="java.util.GregorianCalendar" />
    <c:out value="${now.timeInMillis}" />but now.year/Year/YEAR etc all give me 500 errors. I've also tried
    <jsp:useBean id="now" class="java.util.Date" />
    <c:out value="${now.year}" />But this just yields a constant. I know there is the SimpleDateFormat which I think would go with the java.util.Date example, but I'm not sure how it would be used in this context. Can anyone help me to get the date?

    Or how about using the JSTL tag for it:
    <jsp:useBean id="now" class="java.util.Date" />
    <fmt:formatDate value="${now}"/>This tag leverages the java.text.SimpleDateFormat to do its job.
    Cheers,
    evnafets

  • Display current date and time in a Input text field.

    Hi,
    I am new in ADF trying to convert the Oracle Forms to ADF. I have questions how can I display the current date & time in the input text filed when ever the page opens .
    Thanks in advance.

    Hi,
    Check followings will useful
    current date setting
    Current Date

Maybe you are looking for