date format

  • How to set the date value '2003-04-09 13:29:51' to '2003-04-09 1:29:51 PM'in the table.all the date values should be in this format.

  • SQL Server DOES NOT store datetime as 2003-04-09 13:29:51 or any other format. It stores it as a number of seconds after a specific date. Refer to the Books OnLine.

    Okay, now that's out of my system.

    The datetime value is displayed based on whatever application you use to access the data. If you are using Query Analyzer, it will return the format that is applied to SQL Server.

    However, you can use the CONVERT function to change the format. Refer to the BOL for CONVERT. That will show you the possible formats. I wasn't able to find one that matched your request (yyyy-mm-dd hh:mm:ssAM (or PM)).

    -SQLBill

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply