Link to home
Start Free TrialLog in
Avatar of JuniorBee
JuniorBeeFlag for United States of America

asked on

Formatting ASP date yyyy-mm-dd hh:mm:ss

Hi
I need my date formatted like:
yyyy-mm-dd hh:mm:ss
Is there a function for this?

Thanks!
Avatar of Todd Gerbert
Todd Gerbert
Flag of United States of America image

Yes, check documentation for the .ToString method of the DateTime object.

DateTime dt = DateTime.Now;
Response.Write(dt.ToString("yyyy-MM-dd HH:mm:ss"));

Dim dt As DateTime = DateTime.Now
Response.Write(dt.ToString("yyyy-MM-dd HH:mm:ss"))
ASKER CERTIFIED SOLUTION
Avatar of Todd Gerbert
Todd Gerbert
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
How will the date and time be presented to the function.