Results 1 to 9 of 9
  1. #1
    Join Date
    Dec 2003
    Location
    Lowlands
    Posts
    53

    Unanswered: Weird date transformation

    Hi all,

    i 've got a real strange problem.
    I 'v got an asp.net/vb.net application and a mssql db at the end. I have a form where I can insert some info in the tables. Everything went well for a couple of months, but now my dates transform on a real strange way. no matter wich date I give up, those date's never reach the db.
    example: date = 31-12-2004(Europe date) --> in the db the date is
    21-07-1894
    and I've seen the other dates, the month and the year are the same, they all show me july 1894.

    Has everyone ever seen this before.

    PS. I'm using win2000 service pack 4 with mssql 2000 (no service pack)
    If Perfection really is an Illusion. Then I want to get as close as possible to that Illusion.

  2. #2
    Join Date
    Mar 2004
    Location
    Toronto
    Posts
    28
    I had a similar problem a few months ago. Some VB date conversions stopped working properly all of a sudden.

    It was not a DB problem, but the result of someone changing the system date format (regional settings section in the control panel) on the server. I can't remember which VB function it was, but there was a dependency on this setting in the control panel.

    Might be worth a look...

  3. #3
    Join Date
    Dec 2003
    Location
    Lowlands
    Posts
    53
    thnx for the reply.

    I've looked there also but couldn't see anything that would bring me back to july 1894. I even logged the query that my application sends to the db and the date there is the correct date I wanted to insert.
    This even gets stranger sometimes I change the dates (This also is possible with the application) and the day after the will return to the july 1894-thing.

    I really don't understand it at all.
    If Perfection really is an Illusion. Then I want to get as close as possible to that Illusion.

  4. #4
    Join Date
    Mar 2004
    Location
    Toronto
    Posts
    28
    Can you provide some more detail? (the offending query, table definition, and any debug information)

  5. #5
    Join Date
    Dec 2003
    Location
    Lowlands
    Posts
    53
    well this is all.

    it's just a insert into table1(date1, date2, date3) values(01-01-2004, 31-12-2004, 7-5-2004). this is also the query the db gets i checked out if the application changes anything, but the app doesn't changes a thing.
    and the weird when I use the update syntax there will be the good date for a while and then that also changes to the odd date.

    I run the app no on 3 systems 2 xp and one 2000, all give the same thing.

    hope someone can help...
    If Perfection really is an Illusion. Then I want to get as close as possible to that Illusion.

  6. #6
    Join Date
    Dec 2003
    Location
    Lowlands
    Posts
    53
    well this is all.

    it's just a insert into table1(date1, date2, date3) values(01-01-2004, 31-12-2004, 7-5-2004). this is also the query the db gets i checked out if the application changes anything, but the app doesn't changes a thing.
    and the weird when I use the update syntax there will be the good date for a while and then that also changes to the odd date. This only happens in one table there are other tables with dates but they don't change.

    I run the app now on 3 systems 2 xp and one 2000, all give the same thing.

    hope someone can help...
    If Perfection really is an Illusion. Then I want to get as close as possible to that Illusion.

  7. #7
    Join Date
    Aug 2003
    Location
    Kingston, Ontario
    Posts
    106
    Code:
    insert into table1(date1, date2, date3) values(01-01-2004, 31-12-2004, 7-5-2004)
    What happens if you use apostrophies around the dates as in

    Code:
    insert into table1(date1, date2, date3) values('01-01-2004', '31-12-2004', '7-5-2004')

  8. #8
    Join Date
    Dec 2003
    Location
    Lowlands
    Posts
    53
    Thanx mate,

    because the old way always worked for me I forgot about yours.. Thanx alot
    I only need to check why they sometimes just change but thnx alot again..
    If Perfection really is an Illusion. Then I want to get as close as possible to that Illusion.

  9. #9
    Join Date
    Nov 2002
    Posts
    272
    Quote Originally Posted by StylizIT
    I've looked there also but couldn't see anything that would bring me back to july 1894.
    I do.
    31 - 12 - 2004 = -1985.
    1985 days before 1-1-1900 is July 27, 1894.

    Not quite your July 21, but close

    What date do you get when you insert date = 0 ?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •