save time to database

  • Thread starter Thread starter simon
  • Start date Start date
S

simon

I have time in my program:

for example:

dim timeTest as datetime
timeTest="10:15:10"

I save this time to database as decimal value:

timeTest.ToOADate - I get the decimal value and I save it to database

Then I read from database:

?format(date.FromOADate(test),"hh:mm:ss")

but I don't get the same value.

The ToOADate returns me a decimal number with 57 numbers after decimal.

Should I save all 57 decimals to the database or is there some better
method?

Thank you,
Simon
 
simon said:
I save this time to database as decimal value:

Can't you save the datetime to a datetime field? Decimal fields are for
storing numbers, datetime fields for storing dates and times. If you try to
store datetime values in decimal fields there's always a possibility of the
data being rounded incorrectly, not to mention the fact that the value in
the database is meaningless to anything other than your VB code.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top