How to populate Current Date and Time in OAF page through CO

Hi all,
How can we generate the current system date(without using "select sysdate from dual"), in OAF controller page (processRequest) to an OAMessageDateFieldBean?
When i use the following code, the month is always displayed as January only.
In OAF page its displayed as : 26-Jan-2009 15:46:30
Using System.out.println : 2009-05-26 15:46:30.0
Kindkly help me in this regard.
Code*
OAApplicationModule am = pageContext.getApplicationModule(webBean);
SimpleDateFormat f = new SimpleDateFormat("yyyy-mm-dd hh:mm:ss");
String dateString = am.getOADBTransaction().getCurrentDBDate().toString();
java.sql.Date sqlDate= new Date(f.parse(dateString).getTime());
OAMessageDateFieldBean dateField =
(OAMessageDateFieldBean)webBean.findIndexedChildRecursive("currentDate");
dateField.setValue(pageContext,sqlDate);
System.out.println(am.getOADBTransaction().getCurrentDBDate().toString());
Regards,
Joe

Hi Joe,
Change the line of code....
from
SimpleDateFormat f = new SimpleDateFormat("yyyy-mm-dd hh:mm:ss");
to
SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
It will work....
Thanks
Anoop

Similar Messages

  • How to view current  date and time on SAP screen

    Hi Everybody,
    How to view current  date and time on SAP screen .I have set time zone in T-code STZAC.now iam getting correct date n time in my tranctions but i want to check without any tractions
    Plz repay,Regards,
    Sadik.

    Hi,
    You can check the time by running a report .
    It will show the database and central instance time : Report name :rsdbtime
    Thanks and Regards
    Vijay kumar G
    Edited by: vijay kumar gopal on Mar 4, 2008 1:09 PM

  • Printing current date and time on each page

    I'm often printing several versions of a document (e.g. a paper in progress). To keep track of the printouts I would like to print the date and time of printing onto each page, regardless of which application I'm using (although it would be okay if it works for PDF files only, if it happens automatically). I have seen Windows printer drivers including this feature, but haven't found any settings here (e.g., Canon iR3225) nor any hidden-CUPS-feature-I-could-activate-in-the-config-file.
    Any ideas? Some sort of preprocessing I could inject into cups?

    I agree with Greg. I had a quick look through the cups settings and could not see what you want. The closest thing would be a cover page, which you can also do via the standard print dialog.
    And checking the iR32xx series printer driver on Windows 7, there is no feature to print the date/time within the driver. So as Greg has mentioned your reference to Windows having this feature must be via an application rather than a driver setting.

  • How to print Current date and time

    In my program I put in
    java util.Date now = new java.util(Date);
    the next line is:
    System.out.println("Today's Date is = " + Date);
    when I try to compile it, I get "1 Error"
    what do I do wrong?
    Thank you for your help: Charles.

    You should read a tutorial on Java to learn the basic concepts and syntax.
    java.util.Date now = new java.util.Date();
    System.out.println("It is now " + now); // this will include the time. You can format it using java.text.SimpleDateFormat.

  • How to get the current data and time of SCOM server via SCOM SDK (API) calls?

    Hi,
    I need to read the current date and time of SCOM server via SOM SDK.
    Is there a class in SDK that provides this info ?
    Thanks,
    satheesh

    To get time and date of Alerts of SCOM, You can use following command let "get-scomalert"
    Also, You can refer below links
    http://blog.tyang.org/2013/02/21/using-scom-2012-sdk-to-retrieve-resource-pools-information/
    Please remember, if you see a post that helped you please click "Vote As Helpful" and if it answered your question, please click "Mark As Answer"
    Mai Ali | My blog: Technical

  • How to display the current Date and time in xslt version 1

    i am using xslt version 1 .i want to display the current date and time in the output xml using xslt(Jdeveloper) ..i just added the namespace xmlns:xp20="http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.Xpath20"
         xmlns:ns1="urn:oracle:integration:b2b:7D30046DC68A4FA689956D8241FA3B99">
    and used thsi function <xsl:value-of select = "xp20:current-date()"/>
    but it does not works for me ..help needed????
    Edited by: user9519185 on Jan 20, 2009 3:04 AM

    Use a formula: =NOW()
    Format the cell for Date and Time, with both the Date part and the Time part displayed. Format the two parts as you wish, using the choices in the Inspector's menus.
    The cell will update each time the table is recalculated.
    (Description is for Numbers '09 (Mac), Numbers for iOS will be similar, but not necessarly identical in details.)
    Regards,
    Barry

  • Odd Date for Current Date and Time

    I am modifying a column in a list to get current date and time using =TODAY()+NOW() in the calculated field and get a time that is behind by 1 hour but the date is 4 months 114 years ahead (2128). How can I fix this field?

    http://sharepointsolutions.com/sharepoint-help/blog/2011/04/how-to-add-and-subtract-hours-and-minutes-from-date-and-time-fields-in-sharepoint-lists/

  • Current Date and Time in JLabel

    Hi i am fairly new to Java and i would like to know how i can get a label to show the current date and time ( with seconds) to show up in the top right hand corner.
    Thank you.

    Hi i am fairly new to Java and i would like to know
    how i can get a label to show the current date and
    time ( with seconds) to show up in the top right hand
    corner.
    Thank you.You can use TimerTask to do it. also go through the api for Calendar, Date and DateFormat.

  • Wrote the current Date and Time in the backend

    HI everyone,
    I created a table view, where I display several records. Right now I will add an record to this table, which should be written back in the backend and automaticaly add the current date and time.
    But I don´t know to make this. I tried several time with the funktion  "now()", but it doesn´t work. So any help for me, to explain how I can display the actual time and then write it back to the backend?
    Thanks

    we use a crm system. but the BAPI I mentioned was
    just to play with. My basis will develop a new API
    for the project, that have the requested Inputfields.
    But what I tottaly forget was, that there has to be a
    field for the time, so thanks for the advice.
    No Problem.
    I´m still of the opinion , that it should be possible
    to add the curret time in a field with the
    funcionality of the VC, even there is a way to show a
    clock with the current time. My problem is that I
    can´t figuer out how to do this.
    Therefore you can use the TNow() function (Time functions) and the Now() Function (Date functions). You can cast them to a string and concatenate the string, then you have the date of today with the current time. This string you can format and transfer it as input for your BAPI_ADD_BP for example.
    Hope that helps.
    Best Regards,
    Marcel

  • Put the current date and time in a string

    I am having trouble trying to put the current date and time from my Calendar object into a string
    any ideas?

    Calendar timeCal = Calendar.getInstance();
    timeCal.setTime(new Date(System.currentTimeMillis() - startTime ));
    String date = formatToTwoDigits(timeCal.get(Calendar.HOUR_OF_DAY))     + ":" +
    formatToTwoDigits(timeCal.get(Calendar.MINUTE))          + ":" +
    formatToTwoDigits(timeCal.get(Calendar.SECOND));
    private String formatToTwoDigits(int i) {
    String ret = null;
    i = i % 100;
    if (i < 10) {
    ret = "0" + Integer.toString(i);
    } else {
    ret = Integer.toString(i);
    return ret;
    You can figure out yourselve how to display the date, use other Calendar.XXX properties.
    Good luck!

  • Get  current date and time

    hello.
    How can I get current date and time in JAVA?
    Thanks.

    Sorry, I mean:
    how can I get the value of DATE, MONTH, and YEAR of the
    current date?
         Date date = new Date();
         System.out.println(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 and time

    Hello everyone,
    how can I display the current date and time in a simple text field?
    Best Mobilizer

    Hello,
    You can simply use
    now()
    You can also do more complex things with this.
    Text(Now(),"hh:mm:ss a/p")
    Check the following page for all the possible functions
    http://siena.blob.core.windows.net/beta/ProjectSienaBetaFunctionReference.html#_Toc373745510
    Regards
    StonyArc

  • Get the Current Date and Time of a Location

    I have created a windowsPhoneApplication in silverLight 8.1.In my application,I have to upload videos on some server.The Uploading get failed If the Date and Time settings of my device is not the current Date and Time.So How can I get the current date
    and time even if the device settings is wrong?

    Hi shifana,
    Do you know server's time zone? If yes, you can manually translate to the correct time zone.
    Otherwise try some online time acquire API.
    --James
    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 do I set date and time on apple tv?

    How do I set date and time on apple tv?

    Fixed the same problem, STEPS
    1. Reset your apple TV
    2.It will again stuck on that setting, ignore it by press menu
    3. Unplug ethernet wire
    4. Try to connect with wifi, it should be work with wifi connection as mine.
    5. Then you can switch back Ethernet wire after get fixed.
    Thanks. Lemme know dude if it's work.

Maybe you are looking for

  • How to change the country code for Wireless channel usage

    My MacBook country code is set by Japan. In this case, I can use only 5.15~5.25 channels from ch#36 to ch48 at 5GHz Band. I'd like use the other channels..by other country code. How can I change the Wireless card country code?

  • Garageband refuses to read midi files

    Impossible to read midi files in Gagareband Could you help me ? When i put it over a track nothing happens.

  • Macbook Pro/Sleep with Cinema Display

    I have a 17" Macbook Pro connected to a 23" Cinema display with the lid closed. When the Macbook Pro goes to sleep, eventually, the pulsating white light becomes a solid white light. The problem only occurs with the Cinema Display connected. The only

  • [ZH77A-G43] BETA UEFI Version [E7758IMS.1xx Releases]

    E7758IMS.160 FULL RELEASE BIOS - Support Windows8 Feature. - Update CPU Micro Code. - Update ME8.1 1318 firmware. - Update onboard Realtek UEFI driver. - Improved gaming keyboard compatibility. - Auto select UEFI/Legacy mode by VBIOS & system BIOS. T

  • Java is looking cool

    This is a bit of random post and so I apologise, but i dont know anywhere else I could get all excited about the new snazzy get java buttons. They are just the best thing in the world ever, it makes java look a lot more competant (sounds silly i know