[thelist] SQL Server DateTime Format

Feingold Josh S Josh.S.Feingold at irs.gov
Tue Jun 18 13:12:01 CDT 2002


--
[ Picked text/plain from multipart/alternative ]
Here is the solution I found:

> The current date held in the database is formatted: 6/18/02 9:20:22 AM
>
> I would like it to display to the user as: 6/18/02 0920

To make this conversion in ASP, try:
formatTime = formatDateTime(currentTime,2) & " " &
formatDateTime(currentTime,4)

This will display the date time as: 6/18/02 09:20.  If you need to take out
the colon you can do some string manipulation.

> Also, when the user inserts the time from a form will SQL
> Server accept the
> following format: 6/18/02 0920

SQL server will accept "6/18/02 09:20" with the colon.

Josh



More information about the thelist mailing list