Results 1 to 11 of 11

Thread: Dates from VB into SQL

  1. #1

    Thread Starter
    Fanatic Member holly's Avatar
    Join Date
    Aug 2002
    Location
    Somewhere on earth
    Posts
    721

    Dates from VB into SQL

    Hi

    I have a table which contains a date field....when the fields data
    type is set to date/time the format changes to MM/DD/YYYY but
    yet when the datatype is set to char the format is perfect......

    Why does this happen?.....I'm using a SQL stmt in my VB app to
    update the field......

    Thanks

    ** HOLLY **

  2. #2
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    because of regional settings i guess
    -= a peet post =-

  3. #3

    Thread Starter
    Fanatic Member holly's Avatar
    Join Date
    Aug 2002
    Location
    Somewhere on earth
    Posts
    721
    Peet

    Thanks for replying but the date regional settings are set to
    'dd-mm-yyyy'...??

    Thanks

    Has anyone any suggestions?
    ** HOLLY **

  4. #4
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    oh...

    well I do not know why then


    I do not know the date fields too good... reason being I NEVER use them.... Use text fields
    -= a peet post =-

  5. #5
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974
    It's not the regional settings where you think - it's inside the database engine that matters... and they are all american ('mm-dd-yyyy') by default.

    the way around it is to always send dates to databases in this format: "DD MMM YYYY"
    ..so there can be no confusion about which part of the date is which.

  6. #6

    Thread Starter
    Fanatic Member holly's Avatar
    Join Date
    Aug 2002
    Location
    Somewhere on earth
    Posts
    721
    Si..Thanks for replying

    so instead of trying to send/format the date as DD-MM-YYYY use
    DD-MMM-YYYY - ????

    Thanks
    ** HOLLY **

  7. #7
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974
    yep.. "DD MMM YYYY" works for all database systems I have tried it on

  8. #8
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    mmm I gave up dates a looooong time ago


    all dates saved as YYYYMMDD in text fields..
    -= a peet post =-

  9. #9
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974
    noooooo!!

    oh well, I definitely wouldnt recommend it, but it's up to you

  10. #10
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    heheeh yeahh... thats the beuty of it... its all up to me... the evil progger
    -= a peet post =-

  11. #11

    Thread Starter
    Fanatic Member holly's Avatar
    Join Date
    Aug 2002
    Location
    Somewhere on earth
    Posts
    721
    Hey Si..... it works a treat....Thanks very much!!!
    ** HOLLY **

Posting Permissions

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



Click Here to Expand Forum to Full Width