Putting in Access 97, a DateTime 'date' usingVB.NET

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • robcrann
    New Member
    • Oct 2014
    • 2

    Putting in Access 97, a DateTime 'date' usingVB.NET

    I want to put, in an Access 97 database, using the Access 'Date/Time' datatype, a 'time', using VB.NET with OleDB.

    I start with the time converted to number of seconds.
    eg
    Code:
    Dim long Time = 3661 '(Equivalent to 01:01:01)
    This I incorporate into a query after preceding it with a '.':
    Code:
    "INSERT INTO Data_Set VALUES(.3661)"
    Trouble is, it comes out in access as 10:18:47!

    What am I doing wrong?
    Last edited by Frinavale; Oct 16 '14, 01:33 PM.
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    That's not how a time is stored in Access. The decimal portion of a date time value does not represent the number of seconds elapsed. It represents the percentage of the day that has elapsed. Besides, there's no reason to separate out and store only the time. Just store the full date time value and display just the time.

    Comment

    • robcrann
      New Member
      • Oct 2014
      • 2

      #3
      Access from VB.Net

      Originally posted by Rabbit
      That's not how a time is stored in Access. The decimal portion of a date time value does not represent the number of seconds elapsed. It represents the percentage of the day that has elapsed. Besides, there's no reason to separate out and store only the time. Just store the full date time value and display just the time.
      I succeded in converting the percentage of the day to seconds so am happy - Thanks for your reply anyway. Rob

      Comment

      Working...