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 |
|
khufiamalik
Posting Yak Master
120 Posts |
Posted - 2009-01-13 : 07:13:53
|
| Hello All,I have been facing a problem regarding Datetime.1)I have an SP which Selects a Date and it's result is like2009-01-13 16:11:24.3432)ASP.net Screen displays that date ( Note I have been Using Nullable<DateTime> object on Screen), and This Date is shown here like '1/13/2009 4:11:24 PM' (I dont know why)3) Then I Press a button on screen which calles another SP. In this SP I compare the Screen Date with the Table Date Which looks like this IF '1/13/2009 4:11:24 PM'=2009-01-13 16:11:24.343 BEGIN Print1 END ELSE BEGIN Print 2 ELSEbut it always prints 2.Can any one tell me that how can I Convert "Database Date to Application Style Date" OR "Page Date to the Database Date" format.Thanks in Advance. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-01-13 : 07:21:00
|
| it seems like you're converting datetime to varchar before displaying in asp which is causing this. if yes, remove formatting from t-sql code |
 |
|
|
khufiamalik
Posting Yak Master
120 Posts |
Posted - 2009-01-13 : 07:24:45
|
| No I am not converting it my Self. |
 |
|
|
bklr
Master Smack Fu Yak Hacker
1693 Posts |
Posted - 2009-01-13 : 07:28:41
|
| IF convert(varchar(64),cast('1/13/2009 4:11:24 PM' as datetime),100)= convert(varchar(64),cast('2009-01-13 16:11:24:343' as datetime),100)BEGINPrint 1ENDELSEBEGINPrint 2end |
 |
|
|
khufiamalik
Posting Yak Master
120 Posts |
Posted - 2009-01-13 : 07:34:15
|
| Thnaks alot |
 |
|
|
khufiamalik
Posting Yak Master
120 Posts |
Posted - 2009-01-13 : 07:34:33
|
| Thanks Alot |
 |
|
|
bklr
Master Smack Fu Yak Hacker
1693 Posts |
Posted - 2009-01-13 : 07:34:54
|
ur welcome |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-01-13 : 08:46:28
|
quote: Originally posted by khufiamalik No I am not converting it my Self.
I didnt tell its you But problem is the code which retrieves data from table to asp page. i think there convertion is taking place. |
 |
|
|
|
|
|