Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 86
Default 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   Report Post  
Posted to microsoft.public.excel.programming
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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 86
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
TimeStamp Chris Excel Discussion (Misc queries) 2 April 19th 10 10:15 PM
Timestamp Stephanie Excel Discussion (Misc queries) 0 January 5th 10 06:55 PM
timestamp james Excel Worksheet Functions 2 May 17th 09 06:16 PM
Timestamp ? elroyerni Excel Discussion (Misc queries) 2 June 1st 07 12:07 AM
timestamp tommyboy[_3_] Excel Programming 6 July 7th 04 10:19 AM


All times are GMT +1. The time now is 11:05 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"