Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Format date 1

Status
Not open for further replies.

MrPeds

Programmer
Jan 7, 2003
219
GB
Hi,

I currently have some javascript code that returns a UTC date:

var d = new Date();
document.write (d.toUTCString());

This returns a string like this:

'Sun, 31 May 2009 20:03:23 UTC'

I want to eventually write this to a SQL server database so need to format the string to a sensible format. e.g. I want to convert the date to be in YYYY-MM-DD hh:mm:ss format.

How do I do this? Am a bit of a Js noob :O( e.g. in the above example I want to get 2009-05-31 20:03:23

Thanks,
MrPeds
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top