JavaScript DateTime Conversion

Last post 05-18-2007 4:55 AM by mvark. 2 replies.

Sort Posts:

  • JavaScript DateTime Conversion

    05-15-2007, 11:53 PM
    • Member
      point Member
    • sadeesh
    • Member since 02-02-2007, 9:44 AM
    • Posts 41

    hi

    How is convert DataTime using javascript.

    i want mm/dd/yyyy and hh:mm:ss Am or Pm this format conversion javascript.

    how is convert? my problem database to javascript (Using Ajax Concept) show a full DataTime format ?

    Any function javascript?

    please help me

     

     

    regards

    sadeesh

     

  • Re: JavaScript DateTime Conversion

    05-16-2007, 7:12 AM
    Answer
    • Member
      514 point Member
    • Rubo
    • Member since 09-26-2004, 10:14 AM
    • Armenia
    • Posts 93

    Use Date.parse function. Note that parse returns milliseconds but not Date object.

    Example: var dt = new Date(Date.parse("02/22/2007 2:34:57 PM"));

     

  • Re: JavaScript DateTime Conversion

    05-18-2007, 4:55 AM
    • Contributor
      4,833 point Contributor
    • mvark
    • Member since 09-15-2005, 9:33 AM
    • Posts 644

    If I understand your question correctly, you want to show a given date in the format mm/dd/yyyy hh:mm:ss AM/PM

    To format the date use the custom Date Formatting functions available here - http://javascripttoolbox.com/lib/date/source.php

    You could try it out first - http://javascripttoolbox.com/lib/date/examples.php  to see how it works.

    For the date format you require, try this format - MM/dd/yyyy hh:mm:ss a 

Page 1 of 1 (3 items)