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 |
|
wided
Posting Yak Master
218 Posts |
Posted - 2011-02-24 : 11:11:57
|
| hellodeclare @date1 datetimedeclare @date2 datetimedeclare @date3 datetimeselect @date1 = '01/01/1900 08:41'select @date2 = '01/01/1900 08:00'print @date1-@date2the result is : 'janv 1 1900 12:41AM'why not 'janv 1 1900 00:41AM'i think a problem is am or pmthanks |
|
|
mandm
Posting Yak Master
120 Posts |
Posted - 2011-02-24 : 11:20:21
|
| Look at CONVERT in booksonline. The default format is what you've shown. If you want it to be different you'll need to use CONVERT to change it. |
 |
|
|
wided
Posting Yak Master
218 Posts |
Posted - 2011-02-24 : 11:25:17
|
| how? |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2011-02-24 : 11:27:56
|
| You need to use in SELECT statementdeclare @date1 datetimedeclare @date2 datetimedeclare @date3 datetimeselect @date1 = '01/01/1900 08:41'select @date2 = '01/01/1900 08:00'select @date1-@date2Print actually convert the date to varchar thus converting it to AM formatMadhivananFailing to plan is Planning to fail |
 |
|
|
MIK_2008
Master Smack Fu Yak Hacker
1054 Posts |
Posted - 2011-02-24 : 12:24:43
|
quote: Originally posted by wided hellowhy not 'janv 1 1900 00:41AM'i think a problem is am or pmthanks
The answer of your why is in your value format .. AM or PM is used when you are working over 12 hour format .. where as the one you are looking for is 24 hour format ... How could you want 24 hour format with AM or PM CheersMIK |
 |
|
|
|
|
|