Resources | JavaScript | Date Formatting

Date Formatting:



The following is a simple JavaScript routine that will format the current date (MM/DD/YYYY) and store it in a variable:



All you need to do is to include these variable declarations in a function, and then call "document.write(thedate)" to print out today's date.

Update:

I've gotten a few e-mails asking about how to fix the Date object when it is "broken" on the client's side. Here's a function that will set the date to the proper time:



Want to discuss this article, or other development issues? Visit our message boards!

Or contact us directly with a comment or question on this article: click here !
armbrustconsulting.com