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.
Author |
Topic |
phrankbooth
Posting Yak Master
162 Posts |
Posted - 2007-04-11 : 14:10:19
|
There's gotta be a way to tell a DB not to store datetime fields as 24 hour format but rather standard time notation.So, I don't want this: 2007-04-11 02:01:31.000I do want this: 2007-04-11 02:01:31 AMThis has to be possible but I can't find it.Thanks!--PhB |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2007-04-11 : 14:14:02
|
Why does it matter how the database stores the data? You can't specify this with a datetime date type. Just retrieve your data, then have your presentation layer (your application) change the format to what you want.Tara Kizerhttp://weblogs.sqlteam.com/tarad/ |
|
|
eyechart
Master Smack Fu Yak Hacker
3575 Posts |
Posted - 2007-04-11 : 14:21:40
|
look at the CONVERT function. it can be used to help you format datetime information in your SELECT statement.-ec |
|
|
phrankbooth
Posting Yak Master
162 Posts |
Posted - 2007-04-11 : 14:30:56
|
Well, I was just thinking, why should I worry about converting and the like when the DB can do it for me. But i datatime can't do it then that's that.Thanks!--PhB |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2007-04-11 : 15:56:59
|
quote: Originally posted by eyechart look at the CONVERT function. it can be used to help you format datetime information in your SELECT statement.-ec
If you do this, you are no longer returning DateTimes, you are just returning VARCHARs, which will not sort or compare correctly as a date, and which you cannot use date functions and also your clients will not interpret as a date, rather as a string. Always format your data at the client, never in SQL Server.- Jeffhttp://weblogs.sqlteam.com/JeffS |
|
|
|
|
|