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

save time to database

P: n/a
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

Nov 21 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
simon wrote:
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.

--

(O)enone
Nov 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.