Convert Time to Decimal and or Date to Decimal

# Thread: Convert Time to Decimal and or Date to Decimal

1. Senior Member
Join Date
Dec 1969
Posts
358

## Convert Time to Decimal and or Date to Decimal

What&#039;s the simplest way to convert time to a decimal, so that I can query the database? Thank you.

2. God
Senior Member
Join Date
Dec 1969
Posts
18,177

http://www.aspfaqs.com/aspfaqs/ShowFAQ.asp?FAQID=189

3. Senior Member
Join Date
Dec 1969
Location
Los Angeles, CA
Posts
21,192

## what?

if the value is 04:56<BR><BR>split on :<BR><BR>then join on .<BR><BR><BR>

4. Senior Member
Join Date
Dec 1969
Posts
96,118

## Don't do it!

Store the date and/or time in the DB *AS* a date/time value and query with a date/time value. Period.<BR><BR>Why would you *want* to use something that is, essentially, unreadable???<BR><BR>

5. Senior Member
Join Date
Dec 1969
Posts
358

## RE: Don't do it!

Well, the reason I&#039;m doing that is to allow users to choose their time and dateseparately for a teetime. I&#039;m using the time separately because I&#039;m displaying the specific times in a select box, which will only display the available times. Can I loop through teetime using the time value?

6. Senior Member
Join Date
Dec 1969
Posts
96,118

## What does this have to do...

...with converting the time to a decimal number???<BR><BR>And, yes, you can simply add a time to a date to get a combined date time.<BR><BR>PAGE1:<BR><BR>&#060;SELECT Name="theDate"&#062;<BR>&#060;OPTION&#062;7 May 2002<BR>&#060;OPTION&#062;8 May 2002<BR>...<BR>&#060;/SELECT&#062;<BR><BR>&#060;SELECT Name="theTime"&#062;<BR>&#060;OPTION&#062;7:00 AM<BR>&#060;OPTION&#062;7:04 AM<BR>&#060;OPTION&#062;7:08 AM<BR>...<BR>&#060;/SELECT&#062;<BR><BR>*************<BR><BR>On the next page:<BR><BR>&#060;%<BR>teeDate = CDate( Request("theDate") )<BR>teeTime = CDate( Request("theTime") )<BR>teeDateTime = CDate( teeDate + teeTime )<BR>...<BR>%&#062;<BR><BR>

7. Senior Member
Join Date
Dec 1969
Posts
358

## RE: What does this have to do...

Well, then I shall do it that way. Thank you for you wonderful help. :)

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•