A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Date formatting problem

  1. #1
    I want to add the date to my Flash guestbook...

    Currently I have this:

    entry = "<b>On "+new Date().toString()+", etc. etc.

    which yields: On Mon Oct 22 09:10:06 GMT-0400 2001....

    What I want is something like: On Monday, October 22 2001 at 9:10 AM.....

    How do I use the date object above to configure my date output to get results like that?

    Many Thanks!

    Rick

  2. #2
    Registered User
    Join Date
    Feb 2001
    Posts
    13,041
    Hi,

    today = new Date();
    weekdays = ["Sunday", "Monday", ...];
    weekday = weekdays[today.getDay()];
    monthnames = ["Janury", "February", "March", ...];
    month = monthnames[today.getMonth()];

    etc.

    Musicman

  3. #3
    Hi Musicman,

    So then my string would be:

    entry = "<b>On "+today.getDay().today.getMonth().toString()+" , etc.

    ??

    Thx,

    Rick

  4. #4
    Registered User
    Join Date
    Feb 2001
    Posts
    13,041
    Hi,

    I'd prefer
    entry = "<b>On "+weekdays[today.getDay()]+", "+monthnames[today.getMonth()]+" "+today.getDate()+", "+today.getFullYear()+ ...

    Musicman

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

HTML5 Development Center