DateTime format conversion

Discussion in 'JavaScript' started by michael_1980, Jul 24, 2012.

  1. #1
    Hi All,

    I want to convert my date time format from 2012-07-23 15:50:56
    this format to 23 July 2012, 3:30 PM



    how can I do that using java scriptdn functions?
     
    michael_1980, Jul 24, 2012 IP
  2. Unni krishnan

    Unni krishnan Peon

    Messages:
    237
    Likes Received:
    9
    Best Answers:
    2
    Trophy Points:
    0
    #2
    Unni krishnan, Jul 24, 2012 IP
  3. michael_1980

    michael_1980 Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I want to convert my date time format from 2012-07-23 15:50:56
    this format to 23 July 2012, 3:30 PM

    Any straightway functions available
     
    michael_1980, Jul 25, 2012 IP
  4. Unni krishnan

    Unni krishnan Peon

    Messages:
    237
    Likes Received:
    9
    Best Answers:
    2
    Trophy Points:
    0
    #4
    You can download the script from this link : http://blog.stevenlevithan.com/archives/date-time-format
    Include it in your page in the HEAD tag using this :
    
    <script src="date.format.js"></script>
    
    Code (markup):
    Then use the following to format:
    
    dateFormat(yourTime, "d mmmm yyyy, h:MM TT");
    
    Code (markup):
    Hope this makes it clear.
     
    Unni krishnan, Jul 25, 2012 IP
  5. stefek99

    stefek99 Peon

    Messages:
    28
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    It is never simple!

    GMT, UTC, daylight savings, server time, client time, epoch time, millis... Trial and error, educated guess :)
     
    stefek99, Jul 25, 2012 IP