By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,905 Members | 2,064 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,905 IT Pros & Developers. It's quick & easy.

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

P: 2
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
Expand|Select|Wrap|Line Numbers
  1. Dim long Time = 3661 '(Equivalent to 01:01:01)
This I incorporate into a query after preceding it with a '.':
Expand|Select|Wrap|Line Numbers
  1. "INSERT INTO Data_Set VALUES(.3661)"
Trouble is, it comes out in access as 10:18:47!

What am I doing wrong?
Oct 13 '14 #1

✓ answered 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.

Share this Question
Share on Google+
2 Replies


Rabbit
Expert Mod 10K+
P: 12,366
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.
Oct 13 '14 #2

P: 2
@Rabbit
I succeded in converting the percentage of the day to seconds so am happy - Thanks for your reply anyway. Rob
Oct 14 '14 #3

Post your reply

Sign in to post your reply or Sign up for a free account.