Results 1 to 6 of 6
  1. #1
    Join Date
    Jan 2004
    Location
    Bangalore
    Posts
    8

    Unanswered: Formatting a date type

    Hi,

    I have a date field in one of the database table. I want to retrive it in a particular format,
    "MMM dd yyyy hh:mm:ssSSaa"
    MMM-> Month (Ex. Feb)
    dd -> Date
    YYYY -> Year

    hh-> Hour
    mm->minutes
    ss->seconds
    SSS -> milliseconds
    aa-> AM/PM

    I was trying with to_char() oracle function, but there is no option for millisecond.
    I am able to get uptill "MMM dd yyyy hh:mm:ss:aa" , but not able to get the millisecond field. The millisecond field should be 3 chars length.


    Please advice,


    Thanks,
    - Jay

  2. #2
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    Oracle measures time down to seconds; if your variable (or a table field) is a DATA type, you can't save miliseconds. As far as I know, that is

  3. #3
    Join Date
    Jan 2004
    Location
    Bangalore
    Posts
    8
    So nothing can be done ... hnn ? to get the miliiseconds ..
    hmmm Okay ..


    anyways,
    Thanks a lot
    - Jay.




    Originally posted by Littlefoot
    Oracle measures time down to seconds; if your variable (or a table field) is a DATA type, you can't save miliseconds. As far as I know, that is

  4. #4
    Join Date
    Dec 2003
    Location
    Noida, India.
    Posts
    171
    Datatype DATE stores only till seconds .... datatype TIMESTAMP does store to millisecond!!
    Oracle can do wonders !

  5. #5
    Join Date
    Jul 2003
    Posts
    2,296
    correct!

    PHP Code:
    10:21:04 platform@kod1create table test (
    10:21:12   2  a timestamp);

    Table created.

    Elapsed00:00:00.01
    10
    :21:18 platform@kod1set linesize 50
    10
    :21:27 platform@kod1desc test
     Name                    Null
    ?    Type
     
    ----------------------- -------- ----------------
     
    A                                TIMESTAMP(6
    - The_Duck
    you can lead someone to something but they will never learn anything ...

  6. #6
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    Wow! I'll come back tomorrow to learn something new too
    Thank you, cmasharma & The_Duck!

Posting Permissions

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