www.webdeveloper.com
Results 1 to 5 of 5

Thread: Need Help in Formatting Date "Fri Jul 6 16:01:56 EDT 2007"

  1. #1
    Join Date
    Oct 2008
    Posts
    4

    Question Need Help in Formatting Date "Fri Jul 6 16:01:56 EDT 2007"

    Hi All,

    Can any one help me in formatting Date? I want to send CURRENT date to client in following format:
    "Fri Jul 6 16:01:56 EDT 2007"

    I tried few things but did not get exact format. Please give me code that works on all browsers at least on FF and IE. Please help me out.

    Thanks,
    Ninad Shaha
    Last edited by shahaninad; 10-06-2008 at 02:17 AM. Reason: some imp text missed

  2. #2
    Join Date
    Jan 2005
    Posts
    592
    check this out. i am sure you can find your answer there
    http://blog.stevenlevithan.com/archi...te-time-format

  3. #3
    Join Date
    Oct 2008
    Posts
    4
    Hey thanks for your reply...
    I already checked that site. its contains code for Cold Fusion and I am using simple JS.

  4. #4
    Join Date
    Sep 2006
    Location
    Copenhagen, Denmark
    Posts
    1,253
    #define question (2B || !2B)
    HTMLElement and W3C Event Handling in IE
    My JavaScript Library

    Don't PM me about answers to questions. If I don't reply in a thread it's because:
    • You didn't read the message posting guidelines
    • Your code is too unstructured and/or formatted poorly - correcting it is too time consuming
    • I simply don't know the answer

  5. #5
    Join Date
    Feb 2006
    Posts
    2,927
    Nothing wrong with the format, but to get a Date object you need to create a new Date with the result of Date.parse.

    var s="Fri Jul 6 16:01:56 EDT 2007";
    alert(new Date(Date.parse(s)));

    If you want to display a different string than the computer default, you can redefine the Date.prototype.toString method,
    but it would be better to just write a method that converts the string the way you want.
    Last edited by mrhoo; 10-06-2008 at 12:29 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles