SitePoint Sponsor |
|
User Tag List
Results 1 to 4 of 4
Thread: Dates Problem - MS SQL
-
Dec 16, 2004, 10:42 #1
- Join Date
- Sep 2003
- Location
- Wales
- Posts
- 1,181
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Dates Problem - MS SQL
Hi all, I have a problem when in one table I have dates in the following format, 2004-11-06 18:00:00.000, and in another table I have the date in this format, 2004-10-11 13:00:00.000.
The problem here is that I have the Month and day values in different order (11 (Nov) represents the month values in the above examples), and as I am using the DATEDIFF function to determine the time difference between the date I am coming up with incorrect data.
Is there a way I can get around this?
Thanks
Tryst
-
Dec 19, 2004, 16:41 #2
this is strange
i thought that DateFormat would be consistent throughout the database
either American or British.
you'd have to set the property of both tables to comply to the same formatting
how to achieve that - i would have to reseach it myself - I'll try.
-
Dec 19, 2004, 17:08 #3
- Join Date
- Jul 2002
- Location
- Toronto, Canada
- Posts
- 39,347
- Mentioned
- 63 Post(s)
- Tagged
- 3 Thread(s)
tryst, dates are stored internally as integers, eg 36175
what you are seeing is the default display format
when you do date arithmetic, like DATEDIFF, the expressions are evaluated using the internal formats
can you give examples of invalid results?
-
Dec 21, 2004, 06:52 #4
- Join Date
- Sep 2003
- Location
- Wales
- Posts
- 1,181
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Hi all,
the problem has now been resolved.
Its seems I was stored one date as a NVARCHAR data type, and another as an actual DATETIME data type. My fault
Thanks
Tryst
Bookmarks