Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 extracting date in specific format

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-04-03 : 09:53:38
harsh writes "i have a date column in my table the date is stored in the following format :'1/2/2002 12:11:36 ' i want to extract the date in the following format '1/2/2002' .is there any option other than concating it using datepart().
harsh"

jackstow
Posting Yak Master

160 Posts

Posted - 2002-04-03 : 10:07:48
Look up CONVERT in Books Online. There are lots of options. For example CONVERT(nvarchar(20),TableName.DateCreatedColumn,113) will give you a date in this format - 20 Mar 2002 10:55:16


Go to Top of Page

Jay99

468 Posts

Posted - 2002-04-03 : 10:43:31
quote:

..stored in the following format :'1/2/2002 12:11:36 '...



Actually the datetime data type is stored internally as two 4-byte integers....
quote:
The first 4 bytes store the number of days before or after the base date, January 1, 1900. The base date is the system’s reference date. Values for datetime earlier than January 1, 1753, are not permitted. The other 4 bytes store the time of day represented as the number of milliseconds after midnight.
-BOL page 47




Jay
<O>
Go to Top of Page
   

- Advertisement -