Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 129
Default VBA date difference

Suppose:

Dim odate as String
odate = "8/7/06 1:30 AM"

How do I get the number of days between Now and odate?

Many Thanks.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default VBA date difference

Dim numDays as Long
Dim odate as String
odate = "8/7/06 1:30 AM"

numDays = date - int(cdate(odate))


--
Regards,
Tom Ogilvy

wrote in message
ups.com...
Suppose:

Dim odate as String
odate = "8/7/06 1:30 AM"

How do I get the number of days between Now and odate?

Many Thanks.



  #3   Report Post  
Posted to microsoft.public.excel.programming
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default VBA date difference

MsgBox DateDiff("d", DateValue(odate), Now())

" wrote:

Suppose:

Dim odate as String
odate = "8/7/06 1:30 AM"

How do I get the number of days between Now and odate?

Many Thanks.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 129
Default VBA date difference

Thanks guys.

That knocked it out.

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
Difference betwen Excel Date () Function and System Date Khalil[_2_] Excel Worksheet Functions 2 June 16th 09 01:10 PM
Difference System date and Excel Date function Khalil Excel Worksheet Functions 2 June 16th 09 11:23 AM
Difference between last date of month and given date Nikhil Excel Worksheet Functions 3 June 13th 08 01:03 PM
Calculating Difference Between Start Date & Time And End Date & Ti Samwar Excel Discussion (Misc queries) 2 December 19th 05 12:42 PM
Date Difference Gary[_7_] Excel Programming 2 August 5th 03 06:23 PM


All times are GMT +1. The time now is 09:59 AM.

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

About Us

"It's about Microsoft Excel"