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

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

> 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

> 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