View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Charlie Charlie is offline
external usenet poster
 
Posts: 703
Default Rounding Up a Timestamp

To the next highest minute? I presume you mean one second over goes to the
next minute, i.e. 00:00:01 -- 00:01:00? Add 59 seconds:

Debug.Print Format(CDate("12-04-2005 00:59:00") + CDate("00:00:59"),
"mm-dd-yyyy hh:mm")
Debug.Print Format(CDate("12-04-2005 00:59:01") + CDate("00:00:59"),
"mm-dd-yyyy hh:mm")
Debug.Print Format(CDate("12-04-2005 00:59:59") + CDate("00:00:59"),
"mm-dd-yyyy hh:mm")

Will produce:

12-04-2005 00:59
12-04-2005 01:00
12-04-2005 01:00


"Raul" wrote:

I'm querying a database and the timestamp is coming back to the routine as:
12-04-2005 00:59:59.

I'd like the output the user sees to be 12-04-2005 01:00.

Is there a way to "roundup" a date to the next highest minute.

by the way, I'm using ADO and the data retrieved from the query is being
placed in an array with data type = string and the timestamp string is
converted to a date using CDate prior to being placed in the array.

Thanks in advance,
Raul