| Author |
Topic |
|
christina_rules
Starting Member
23 Posts |
Posted - 2007-05-27 : 02:28:35
|
| i've used datetime to store my date and when i read from the database, it displays 12:00:00am as well!..is there any datatype i can use? |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
|
|
christina_rules
Starting Member
23 Posts |
Posted - 2007-05-27 : 03:45:58
|
| oh..let's say even i set the time to midnight, the time still displays doesn't it?..however, i don't want it to be displayed. |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-05-27 : 05:46:55
|
use. The time will still be there. You can use convert() to remove it for do the formatting in your front end to display the date in the format that you want. KH |
 |
|
|
christina_rules
Starting Member
23 Posts |
Posted - 2007-05-27 : 21:29:53
|
| thanks, kh..i found something like this on the net "Convert(varchar(10), Create_Date, 101)"..but what is 101? |
 |
|
|
rmiao
Master Smack Fu Yak Hacker
7266 Posts |
Posted - 2007-05-27 : 22:13:31
|
| It's style code, displays date in mm/dd/yyyy format. |
 |
|
|
jezemine
Master Smack Fu Yak Hacker
2886 Posts |
Posted - 2007-05-27 : 23:33:05
|
I have a dim recollection of reading somewhere that SQL Server 2008 will finally have separate date and time types, but I can't find the link where I read that. www.elsasoft.org |
 |
|
|
Jeff Moden
Aged Yak Warrior
652 Posts |
Posted - 2007-05-28 : 00:18:20
|
quote: Originally posted by christina_rules thanks, kh..i found something like this on the net "Convert(varchar(10), Create_Date, 101)"..but what is 101?
Lookup CONVERT in "Books Online" (in Query Analyzer, click {Help}{Transact-SQL Help}) for a whole list of canned date conversions including the "101".--Jeff Moden |
 |
|
|
Jeff Moden
Aged Yak Warrior
652 Posts |
Posted - 2007-05-28 : 00:20:48
|
quote: Originally posted by jezemine I have a dim recollection of reading somewhere that SQL Server 2008 will finally have separate date and time types, but I can't find the link where I read that. www.elsasoft.org
I guess I'll never understand why people need such a thing when the coversions we all know so well work so well. And, if it's something that needs to be done often for a given table, why don't folks just add a calculated column to the table with the appropriate conversion?--Jeff Moden |
 |
|
|
jezemine
Master Smack Fu Yak Hacker
2886 Posts |
Posted - 2007-05-28 : 02:21:02
|
that's sort of like saying you don't understand why anyone would need tinyint, smallint, or int when we have bigint. the point is, sometimes datetime/smalldatetime is just not appropriate for the data being stored. so it wastes space, just as bigint would if you used it to store what really ought to be a tinyint.date would be appropriate for Columns like Birthday, etc.time would be appropriate for Columns like WhenToGetUpInTheMorning, etc. www.elsasoft.org |
 |
|
|
|