change time & date into long integer

  • Thread starter Thread starter Wilmar
  • Start date Start date
W

Wilmar

Want to change time (14:15) and date (14-11-2003) into a (long) integer.
It works easy in Excel, but is it possible as well in Access?


Will
 
Want to change time (14:15) and date (14-11-2003) into a (long) integer.
It works easy in Excel, but is it possible as well in Access?

What "long integer"? 1415 and 14112003, or 1415 and 20031114 (which
will sort chronologically), or what? And WHY?

You can use the Format() function to do this: e.g.

CLng(Format([datefield], "yyyymmdd"))

to do the latter.
 
Want to change time (14:15) and date (14-11-2003) into a (long) integer.
It works easy in Excel, but is it possible as well in Access?

You can use the internal values for the date, but the time value is less
than one, so it won't make an integer. You could of course scale it:

dwDays = CLng(DateValue(dtMyDateTime))

dwSecs = CLng(CDbl(TimeValue(dtMyDateTime) * 60 * 60 * 24))

But you really need to define what values you want, or else you can have up
to 32,768 different solutions...


All the best


Tim F
 
Back
Top