Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hi there

i have some doubts which are

1-can i have only time field or date field in MS SQL SERVER 2005 ,,,all i see is datetime and there is no fromat to change ?

2- i have a time let say "02:23" how can i know that this tim is am or pm ???


stupid ones but mind is asking


thanx alot
Posted

SQL 2005 does not have a DATE format, only DateTime. I think it may be SQL 2012 that has a date format. However, what you'll store in the database is 0 for the day, which depending on your COLLATION may be 1/1/1900 and then store the time. The time is stored in 24 hour format so 1:00 PM is 13:00.

The displaying and formatting of the date and time is handled through your program but is stored as datetime in the db.
 
Share this answer
 
Quote:
SQL 2005 does not have a DATE format, only DateTime. I think it may be SQL 2012 that has a date format. However, what you'll store in the database is 0 for the day, which depending on your COLLATION may be 1/1/1900 and then store the time


aha i got it

but the 2nd ques
Quote:
The time is stored in 24 hour format so 1:00 PM is 13:00.

the tim is not stored in pm or am
i want to write am and pm ?
how can i do that ?
 
Share this answer
 
Comments
Thanks7872 21-Sep-13 2:09am    
Use 'Have question or comment' button below answer. Otherwise the one won't get any notification.Remove this as this is not an answer.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900