Extracting the date out of a Date/Time field 
Author Message
 Extracting the date out of a Date/Time field

There's got to be a simple function to do this that I just can't find in
online help!

I've got a field in a table (dteDateTime) that is filled at various times
using the Now() function to insert the system date and time.  I'm trying to
build a query that uses the Date or Time portions independently.  Are there
a pair of functions that return only the date or time part of the field as
in:

    DatePortion = MagicalDateFunction(dteDateTime)
    TimePortion = MagicalTimeFunction(dteDateTime)

I understand that the date is stored as the integer part of a float
(variant) and the time is stored as the fractional part.  I guess what these
functions would do is isolate the integer or fractional parts respectively.

I certainly appreciate the input!

April



Mon, 17 Dec 2001 03:00:00 GMT  
 Extracting the date out of a Date/Time field
DatePortion = DateValue(dteDateTime)
TimePortion = TimeValue(dteDateTime)

HTH.

Quote:

> There's got to be a simple function to do this that I just can't find in
> online help!

> I've got a field in a table (dteDateTime) that is filled at various times
> using the Now() function to insert the system date and time.  I'm trying to
> build a query that uses the Date or Time portions independently.  Are there
> a pair of functions that return only the date or time part of the field as
> in:

>     DatePortion = MagicalDateFunction(dteDateTime)
>     TimePortion = MagicalTimeFunction(dteDateTime)

> I understand that the date is stored as the integer part of a float
> (variant) and the time is stored as the fractional part.  I guess what these
> functions would do is isolate the integer or fractional parts respectively.

> I certainly appreciate the input!

> April

--

Beer, Wine and Database Programming.  What could be better?
Visit "Doug Steele's Beer and Programming Emporium"
http://webhome.idirect.com/~djsteele/



Mon, 17 Dec 2001 03:00:00 GMT  
 Extracting the date out of a Date/Time field
Lol.   You mean that's it?  Just tested it and it works perfectly.  Much
Thanks!

April


Quote:
> DatePortion = DateValue(dteDateTime)
> TimePortion = TimeValue(dteDateTime)



Mon, 17 Dec 2001 03:00:00 GMT  
 Extracting the date out of a Date/Time field


Quote:
> There's got to be a simple function to do this that I just can't find
in
> online help!

> I've got a field in a table (dteDateTime) that is filled at various
times
> using the Now() function to insert the system date and time.  I'm
trying to
> build a query that uses the Date or Time portions independently.  Are
there
> a pair of functions that return only the date or time part of the
field as
> in:

>     DatePortion = MagicalDateFunction(dteDateTime)
>     TimePortion = MagicalTimeFunction(dteDateTime)

> I understand that the date is stored as the integer part of a float
> (variant) and the time is stored as the fractional part.  I guess
what these
> functions would do is isolate the integer or fractional parts

respectively.

DatePortion = Int(dteDateTime)
TimePortion = dteDateTime - Int(dteDateTime)

--
Dirk Goldgar

(please direct email replies to

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.



Tue, 18 Dec 2001 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Matching system date/time with field date/time

2. ADO with Access Date/Time field not storing the time, just the date

3. Extracting Date Only from Date/Time

4. Compare date in form with date/time in form with date/time in database

5. Date part of Date/Time Field

6. Null date values in Date/Time fields in Access DB

7. CR8 Distinct dates in Date/Time Field

8. date/time field only shows date

9. combining a time and a date to one Date/Time value

10. start date/time, end date/time problem

11. How to subtract a date-time from a date-time

12. Converting %date% %time% to VB Time/Date

 

 
Powered by phpBB® Forum Software