DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: Date Format Wrong

  1. #1
    Join Date
    Jan 2001
    Posts
    515

    Date Format Wrong

    I have the sysdate formatted to come out in my log with the following format : to_char(sysdate,'fmMonth ddth, YYYY, "at" HH:MI A.M.')

    but when it comes out it does not print the zeros:

    March 5th, 2003, at 9:5 A.M.

    which should be March 5th, 2003, at 9:05 A.M.

    Anyone know why this is happening?

  2. #2
    Join Date
    Dec 2000
    Location
    Ljubljana, Slovenia
    Posts
    4,439
    It's happening because you have "fm" in your format model. From Oracle docs:
    "In a date format element of a TO_CHAR function, this modifier suppresses blanks in subsequent character elements (such as MONTH) and suppresses leading zeroes for subsequent number elements (such as MI) in a date format model."

    Remove the "fm" from your format string or replace it with "fx", ie
    'Month ddth, YYYY, "at" HH:MI A.M.' or 'fxMonth ddth, YYYY, "at" HH:MI A.M.'
    Jurij Modic
    ASCII a stupid question, get a stupid ANSI
    24 hours in a day .... 24 beer in a case .... coincidence?

  3. #3
    Join Date
    Jan 2001
    Posts
    515

    thanks..

    thanks you

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width