Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Rounding Up a Timestamp
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Rounding Up a Timestamp
Thanks a bunch!
Raul "Charlie" wrote: 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
TimeStamp | Excel Discussion (Misc queries) | |||
Timestamp | Excel Discussion (Misc queries) | |||
timestamp | Excel Worksheet Functions | |||
Timestamp ? | Excel Discussion (Misc queries) | |||
timestamp | Excel Programming |