Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. VB6 date vs SQL Server date

VB6 date vs SQL Server date

Scheduled Pinned Locked Moved Visual Basic
databasesql-servervisual-studiosysadmin
5 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    gpa2000
    wrote on last edited by
    #1

    To simplify date conversion i was adviced to use to integer converted dates i.s.o. the datetime type. Now i have the integer 37954 which resembles 01-12-2003 (dd-mm-yyyy) select cast(37954 as datetime) as startdate But VB6 thinks it is 29-11-2003 ?Format(37954, "dd-mm-yyyy") How is this possible? What am i doing wrong? Grtz, Guus

    A G J 3 Replies Last reply
    0
    • G gpa2000

      To simplify date conversion i was adviced to use to integer converted dates i.s.o. the datetime type. Now i have the integer 37954 which resembles 01-12-2003 (dd-mm-yyyy) select cast(37954 as datetime) as startdate But VB6 thinks it is 29-11-2003 ?Format(37954, "dd-mm-yyyy") How is this possible? What am i doing wrong? Grtz, Guus

      A Offline
      A Offline
      Anonymous
      wrote on last edited by
      #2

      :omg::mad::confused::|:cool::|:);P;):):):wtf::suss:

      1 Reply Last reply
      0
      • G gpa2000

        To simplify date conversion i was adviced to use to integer converted dates i.s.o. the datetime type. Now i have the integer 37954 which resembles 01-12-2003 (dd-mm-yyyy) select cast(37954 as datetime) as startdate But VB6 thinks it is 29-11-2003 ?Format(37954, "dd-mm-yyyy") How is this possible? What am i doing wrong? Grtz, Guus

        G Offline
        G Offline
        Guerven
        wrote on last edited by
        #3

        I don't have any Idea. Sorry but it seems awkward to use integers for dates. I think youd be better off using normal Date data. or I suggest ask the one who adviced you.:) Marvin N. Guerrero - Casting More!!

        G 1 Reply Last reply
        0
        • G Guerven

          I don't have any Idea. Sorry but it seems awkward to use integers for dates. I think youd be better off using normal Date data. or I suggest ask the one who adviced you.:) Marvin N. Guerrero - Casting More!!

          G Offline
          G Offline
          gpa2000
          wrote on last edited by
          #4

          In any format, dd-mm-yyyy or mm-dd-yyyy 73584 still means December 1st 2003. You have to retrieve the regional settings to get it right. That's why i use integers.

          1 Reply Last reply
          0
          • G gpa2000

            To simplify date conversion i was adviced to use to integer converted dates i.s.o. the datetime type. Now i have the integer 37954 which resembles 01-12-2003 (dd-mm-yyyy) select cast(37954 as datetime) as startdate But VB6 thinks it is 29-11-2003 ?Format(37954, "dd-mm-yyyy") How is this possible? What am i doing wrong? Grtz, Guus

            J Offline
            J Offline
            jonathan15
            wrote on last edited by
            #5

            Have you tried storing dates as strings? Easy to display in the format you want and easy to convert correctly to date/time format for any calculations that you need to perform on them. Just be sure to confirm the value is a valid date before storing (use isdate() function) Jon

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups