Trasnform current date to format MM/dd/yyyy HH:mm:ss AM/PM

Hi All,
How do I transform current date to format MM/dd/yyyy HH:mm:ss AM/PM?
I am able to get the format MM/dd/yyyy HH:mm:ss by using the standard date function. How do I get AM or PM to end of MM/dd/yyyy HH:mm:ss??
Thanx
Navin

Hi Navin,
How AM/PM is added? In the sample values given its in 24 hrs notation. Are u sure you want to add AM/PM to this notation? or U want to change this 24 hrs notation into 12 hrs and add AM/PM?
For converting into 12 hrs and appending AM/PM you can use this code:
input a:
int hr = Integer.parseInt(a.substring(11,13));
String appendVal = "AM";
if(hr > 12){
   hr = hr - 12;
   appendVal = "PM";
} else if(hr == 12){
   appendVal = "PM";
} else if(hr == 00){
   hr = hr + 12;
Sting finalVal = a.substring(0,11) + String.ValueOf(hr) + a.substring(13,a.length()) + appendVal;
return finalVal;
Regards,
P.Venkat
Message was edited by:
        Venkataramanan

Similar Messages

  • SQL * Loader : Load data with format MM/DD/YYYY HH:MI:SS PM

    Please advice how to load data with format MM/DD/YYYY HH:MI:SS PM into an Oracle Table using SQL * Loader.
    - What format should I give in the control file?
    - What would be the column type to create the table to load data.
    Sample data below;
    MM/DD/YYYY HH:MI:SS PM
    12/9/2012 2:40:20 PM
    11/29/2011 11:23:12 AM
    Thanks in advance
    Avinash

    Hello Srini,
    I had tried with the creation date as DATE datatype but i had got an error as
    ORA-01830: date format picture ends before converting entire input stringI am running the SQL*LOADER from Oracle R12 EBS front-end.
    the contents of my control file is
    LOAD DATA
    INFILE "$_FileName"
    REPLACE
    INTO TABLE po_recp_int_lines_stg
    WHEN (01) = 'L'
    FIELDS TERMINATED BY "|"
    OPTIONALLY ENCLOSED BY '"'
    TRAILING NULLCOLS
    INDICATOR                POSITION(1) CHAR,
    TRANSACTION_MODE          "TRIM(:TRANSACTION_MODE)",
    RECEIPT_NUMBER               "TRIM(:RECEIPT_NUMBER)",
    INTERFACE_SOURCE          "TRIM(:INTERFACE_SOURCE)",
    RECEIPT_DATE               "TO_CHAR(TO_DATE(:RECEIPT_DATE,'MM/DD/YYYY'),'DD-MON-YYYY')",
    QUANTITY               "TRIM(:QUANTITY)",
    PO_NUMBER               "TRIM(:PO_NUMBER)",
    PO_LINE_NUMBER               "TRIM(:PO_LINE_NUMBER)",
    CREATION_DATE               "TO_CHAR(TO_DATE(:CREATION_DATE,'MM/DD/YYYY HH:MI:SS AM'),'DD-MON-YYYY HH:MI:SS AM')",
    ERROR_MESSAGE                   "TRIM(:ERROR_MESSAGE)",
    PROCESS_FLAG                    CONSTANT 'N',
    CREATED_BY                      "fnd_global.user_id",
    LAST_UPDATE_DATE                SYSDATE,
    LAST_UPDATED_BY                 "fnd_global.user_id"
    {code}
    My data file goes like
    {code}
    H|CREATE|123|ABC|12/10/2012||||
    L|CREATE|123|ABC|12/10/2012|100|PO12345|1|12/9/2012  2:40:20 PM
    L|CORRECT|123|ABC|12/10/2012|150|PO12346|2|11/29/2011 11:23:12 AM{code}
    Below is the desc of the table
    {code}
    INDICATOR             VARCHAR2 (1 Byte)                         
    TRANSACTION_MODE        VARCHAR2 (10 Byte)                         
    RECEIPT_NUMBER             NUMBER                         
    INTERFACE_SOURCE        VARCHAR2 (20 Byte)                         
    RECEIPT_DATE             DATE                    
    QUANTITY             NUMBER                    
    PO_NUMBER             VARCHAR2 (15 Byte)                         
    PO_LINE_NUMBER             NUMBER                         
    CREATION_DATE             TIMESTAMP(0)                         
    ERROR_MESSAGE             VARCHAR2 (4000 Byte)                         
    PROCESS_FLAG             VARCHAR2 (5 Byte)                         
    CREATED_BY             NUMBER               
    LAST_UPDATE_DATE        DATE               
    LAST_UPDATED_BY             NUMBER     {code}
    Thanks,
    Avinash                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Problem with oracle.jbo.domain.Date and format 'dd.MM.yyyy'

    JBO-25009: Cannot create an object of type:oracle.jbo.domain.Date with value: 09.10.2003
    In EOImplMsgBundle :
    {"Dbeg_FMT_FORMATTER", "oracle.jbo.format.DefaultDateFormatter"},
    {"Dbeg_FMT_FORMAT", "dd.MM.yyyy"}};
    In VOImplMsgBundle :
    {"Dbeg_FMT_FORMAT", "dd.MM.yyyy"},
    {"Dbeg_FMT_FORMATTER", "oracle.jbo.format.DefaultDateFormatter"},
    Why ? Help Please

    I have the same problem !
    I have extended the formatinfo.xml with:
    <DOMAIN CLASS="oracle.jbo.domain.Date">
    <FORMATTER name="Simple Date" class="oracle.jbo.format.DefaultDateFormatter">
    <FORMAT text="dd.MM.yyyy" />
    <FORMAT text="dd-MM-yyyy" />
    <FORMAT text="yyyy-MM-dd" />
    <FORMAT text="yyyy-MM-dd G 'at' hh:mm:ss" />
    <FORMAT text="EEE, MMM d, ''yy" />
    </FORMATTER>
    </DOMAIN>
    And then I have set my attibutes to use this FORMATTER with FORMAT "dd.MM.yyyy".
    When I start my application, I became an error and the date-fields are blank ... The application can not convert my Date in 'dd.MM.yyyy' format ...
    When I set my attributes to Format Type <none>, it works, the date-fields are present ...

  • Date extract format mm/dd/yyyy

    Hi,
    In db i have date stored like this for a particular record
    1112013
    How to extract this through a query so that i will get
    mm/dd/yyyy format.
    Thanks,

    user10873676 wrote:
    Data is already there in the table.. table datatype is varchar2(20) ...
    Now we are unable to retreive data from front end as different formats of date are already present in this table
    for some date like 852013 we can get the output as 8/5/2013
    for some date like 11122013 we can get the output as 11/12/2013
    but now the problem is some dates are of length 7... which is 1112013... in this case i am not able to make out just like said in the above replies whether it is 1st Nov or 11th Jan...
    we can make it as a date column and store it in the future in the date formats , but what about the existing ones... may be these have been stored previous or dumped into this table like this.
    Is there a way to get these queried and displayed in the front end in a proper way ?
    This is a prime example of why dates should be stored in DATE columns.
    You need to find the person who 'designed' that table and force them to go through every single ambiguous date and
    investigate what it should be - that'll teach them not to make that mistake again!
    BTW: even 852013 and 11122012 are ambiguous - how do you know if it is 8-May-2013 or 5-Aug-2013 and 11-Dec-2013 or 12-Nov-2013?

  • Current date in report

    hi all
    if i make the source for a field is a current date with formate dd/mm/rrrr hh:mi:ss
    and the report published on the application server
    and the clients from diffrent machines run this report
    what the field display on cline or on DB or On Application Server?
    thanks

    dear Viru,
    you can try to put '=NOW()' in the excel cell you want to display and save as worrbook.
    there also some other text from bex query
    menu business explorer -> display text elements -> general
    Re: Date should be displayed on query execution
    hope this helps.

  • Importing ansi date time format into diadem

    Hi,
    I have an ANSI data log txt file with the time channel format  30/03/2006 15:51:08.846 and i am trying import into DIADEM  using the date/time format dd/mm/yyyy hh:nn:ss.fff , but when the file is imported, the time channel cells appear as NO VALUE. Can anybody help please ?
    AdeK

    Hi Adek,
    Here is a DataPlugin which loads your data file into DIAdem 10.2.  There are a number of advantages to using a DataPlugin over the ASCII Import Wizard, so long as your data files follow a similar data file structure.  To register the DataPlugin, just detach the ZIP file, unzip the URI file within, then double-click on the URI file in Windows Explorer.  After that, you will be able to load your TXT data files by dragging&dropping them directly from the NAVIGATOR tree view or Search Results into the Data Portal on the right hand side of DIAdem.  DataPlugins also support selective loading, register loading, reduced loading, and DataFinder indexing, so all of these immediately become available to you with your TXT files.  Note also that header lines 2-4 are now declared as both File and Group properties.
    Ask if you have questions using the DataPlugin,
    Brad Turpin
    DIAdem Product Support Engineer
    National Instruments
    Attachments:
    Adek_TXT.zip ‏2 KB

  • 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.

  • Get current date in mm/dd/yyyy format

    Need to get todays date in the format mm/dd/yyyy and store it in a database by using JDBC API ..how to convert Date given by Date() to the format mmdd/yyyy .The column type of the table whr date has to be inserted is of Type Date/Time (Microsoft Access)..
    Plz help me out ..plzzz..

    public static byte TIME_ONLY = 1;
    public static byte DATE_ONLY = 2;
    public static byte DATE_ALL = 3;
    public static String getCurrentDateTime(byte format, String dateFormatPattern) {
         String[] stringArray;
            String sDate;
         Date today;
         SimpleDateFormat formatter;
         formatter = new SimpleDateFormat(dateFormatPattern);
         today = new Date();
         sDate = formatter.format(today);
         if (format != DATE_ALL) {
              stringArray = sDate.split(" ");
              if (format == DATE_ONLY) {
                   sDate = stringArray[0].trim();
              } else {
                   sDate = stringArray[1].trim();
            return sDate;
    }

  • How to get current date in a specified format ?

    Hi,
    I want to get the current date (java.util.Date()) in the format yyyy-MM-dd HH:mm:ss.
    Can you please tell me as to how to get that ?
    Regards

    I have used the same and the code looks like this. But i am getting java.text.ParseException : UnParseable Date: "Fri Jul 11 13:29:43 CDT 2003"
    The Code is :
    java.util.Date sysDate = new java.util.Date();
    SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    String formatted_date = df.format(sysDate);
    It is erroring out in the last statement !!

  • 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%>

  • Current date format

    Hello-
    This seems like it should be so obvious and simple.  I want the current date to pop up on a form letter.  However, my only choice seems to be the format of 1/11/11.  This isn't very professional looking, so I would like it to be 'January 11, 2011'.  Why can't I override the format on the Calculated - Read Only or Runtime Property of the Object Value Type section???
    Sorry if this is an old question - seems so silly.
    Thanks for any info!!

    Thanks Geo - that worked!
    Even added the current time in a separate field using:
    Num2Time(Time(), "hh:MM:SS A")
    Is there a way to output the date AND time in the same form field?
    I tried entering:
    Num2Date(Date(), "D MMM YYYY") Num2Time(Time(), "hh:MM:SS A")
    But it did not work...

  • Show Current Date in Year Format (and now - 1, etc.)

    Our form has some column headers that need to change each year, the headings are current year (2010) + previous 3 years.  Am trying to programatically add the titles to eliminate modifying the form just to change the year, but not finding how to accomplish, and was checking out some date samples found, but no success yet.  My question is 2 part - how/where do I put code, I don't need the user to enter anything, just want a column header.  This example below is where I copied the idea from a sample and tried to adjust, it's on the calculate event of a date/time field, and I get an error message that says 'the display pattern "date-{MM/DD]" is incompatible with the object's data format.  Define a compatible Display pattern.  This display pattern error is the 2nd part of the question.  How do I display only the 4 digit year?
    year1.rawValue
    = num2date(date(), "YYYY")
    How do I accomplish this - am newbie on this!  Thank you very much!

A: Show Current Date in Year Format (and now - 1, etc.)

1) I typically use a hidden field to capture the current date on the layout:ready event.
2) If year1 is a date object  your script is valid but you are probably missing the display pattern date{YYYY} on year1.
If year1 is a text field you could could capture current year in a hidden field as
// form1.page1.currentYear::ready:layout - (FormCalc, client)
$.rawValue = Num2Date(Date(), "YYYY")
where currentYear has the display pattern date{YYYY} and add
this.rawValue = form1.page1.currentYear.rawValue;
to the calculate event of year1.
Steve

1) I typically use a hidden field to capture the current date on the layout:ready event.
2) If year1 is a date object  your script is valid but you are probably missing the display pattern date{YYYY} on year1.
If year1 is a text field you could could capture current year in a hidden field as
// form1.page1.currentYear::ready:layout - (FormCalc, client)
$.rawValue = Num2Date(Date(), "YYYY")
where currentYear has the display pattern date{YYYY} and add
this.rawValue = form1.page1.currentYear.rawValue;
to the calculate event of year1.
Steve

  • Converting date format MM/DD/YYYY to DD/MM/YYYY in ISA B2B App

    Hi All,
    We have implemented CRM ISA 5.0 (B2B) application. Is it possible to change the date format to DD/MM/YYYY in ISA B2B web application. Now currently it is showing MM/DD/YYYY in all the pages. We need to change this format to DD/MM/YYYY, where and which the date shows the current format of MM/DD/YYYY. Is there any way in XCM settings to change the date format to achieve this. Do we require custom coding ?
    Kindly suggest us!!!
    Thanks and Regards,
    Saravanan

    Hi ,
    If the sol doesn't work with the system settings, do try passing the values in char format after concatenating appropriately adding "-".
    This ll work.
          date = '02252010'. "mmddyyyy"format
          concatenate date+2(2) '-'
                      date+0(2) '-'
                      date+4(4) into var.
    var-25-02-2010dd-mm-yyyy format.
    pass the variable 'var' to the webshop/web application.

  • Problem in date formatting DD-MMM-YYYY

    Hi,
    I am writing a method in my Application:
    //@@begin FormatDate()
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-mm-dd");
         Date d;
         String OutDate = "";
         try {
              d = dateFormat.parse(InDate);
              dateFormat.applyPattern("DD-MMM-YYYY");
              OutDate = dateFormat.format(d);
         } catch (ParseException e) {
              wdComponentAPI.getMessageManager().reportWarning("Date Parse Exception");
         return (OutDate);
        //@@end
    The OutDate that I get is in Format DD-MMM-YYYY but MMM is in digits instead of letters i.e. for 2007-07-31 it gives 31-007-2007 instead of 31-Jul-2007.
    Any clues to get proper output??
    I have tried applying format DD-MON-YYYY it too doesn't help.
    Thanks
    Anagha

    Hi ..
    check this link..
    https://help.sap.com/javadocs/NW04/current/wd/com/sap/tc/webdynpro/services/sal/localization/api/IWDResourceHandler.html
    https://help.sap.com/javadocs/NW04S/current/wd/com/sap/tc/webdynpro/services/sal/localization/api/IWDResourceHandler.html#formatDate(java.util.Date)
    How to calculate next date in Java
    Re: Problem with DATE field
    Hope this will helpful for u..
    Urs GS

  • JHS-00114: Date $CURRENT_DATE$ must be of format MM-dd-yyyy

    I am using jheadstart 10.1.2.2(build 32) in jdeveloper 10.1.2.1.0(build 1913).
    I need to display current date for a date field as a default value when inserting new rows.
    I set $CURRENT_DATE$ in default display value for that date field. The default value(todays date) is displayed only on a tabel(multi row insert is allowed) and on a form(single row insert) I get the above error JHS-00114: Date 2007-01-02 14:18:37.0 must be of format MM-dd-yyyy.
    The problem with multirow insert on a table even though it displays default value is user has to fill in other mandatory fields in the row since jheadstart thinks that user already started entering new row.
    It's ok for me if the default value is displayed properly on either table or form.
    Thanks for any help.
    Lavanya.

    Whenever you are in PM:
    sys@sid1> l
    1* select to_char(sysdate, 'MM/DD/YYYY HH12:MI:SS AM') from dual
    sys@sid1> /
    TO_CHAR(SYSDATE,'MM/DD
    07/09/2007 01:22:48 PM
    1 row selected.
    My time is 1:22:48 PM here. Even though I put AM in the to_char format, it noticed it was PM and changed it.

  • Maybe you are looking for

    • Media Manager - Album Info

      Folks, I have about 300 CDs ripped as wav files to my PC. The are organized in folders artist/album. I have managed to get Media Monkey (a music manager) and Windows Media Player 11 to recognize album names and display album art even though wav files

    • Problem in Flash

      I have a rotating carousel that I would like to have rotate image by image by pressing buttons rather than by mouse position. Anyone know how to do that?

    • What would cause man (man-db) to generate blank manpages?

      I've been experimenting with compiling various GNU packages from source for use in a very minimal chroot environment, among them man-db and dependencies (bash, gdbm, zlib, groff, less). However, I've noticed something odd: if I type `man <something>`

    • How to share data (etc pictures) between local users on same box

      Hello. It kinda makes me angry, that so basic situation needed in many families, where single pc is shared between multiple users, and I can't find easy and elegant solution on linux as long as I'm using it. I have 2 users on same notebook, and I wan

    • R12 jDeveloper tutorial

      Hello Gurus, I cannot find a R12 jDeveloper tutorial. Even when i download Jdev patch: p9879989_R12_GENERIC it has a tutorial that seems to be for R11 Can someone tell me where to find tutorial for R12 (jDev 10.1.3.3.0) Many thanks. Brian