By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,984 Members | 2,794 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,984 IT Pros & Developers. It's quick & easy.

how time is calculated

100+
P: 198
Hi
i am getting probleum in calculating time difference between two time values
e.g.
starttime =12:56:05 PM
endtime = 1:16:29 AM //wrong value
endtime=1:16:29 PM // correct value
but when i insert the value in endtime variable it converts PM Into AM
and i want the same value i,e endtime = 1:16:29 PM
starttime and endtime have date datatype and default value in these variables have "12:00:00"
please tell me the solution how can i solve this probleum

varinder
Jun 30 '08 #1
Share this Question
Share on Google+
2 Replies


QVeen72
Expert 100+
P: 1,445
Hi,

Try this :

Expand|Select|Wrap|Line Numbers
  1.     Dim StTime As Date
  2.     Dim ETime As Date
  3.     StTime = CDate("12:56:05 PM")
  4.     ETime = CDate("1:16:29 PM ")
  5.     MsgBox DateDiff("n", StTime, ETime)
  6.  
Regards
Veena
Jun 30 '08 #2

100+
P: 198
Thanks Very Much
it is working

best regards
varinder


Hi,

Try this :

Expand|Select|Wrap|Line Numbers
  1.     Dim StTime As Date
  2.     Dim ETime As Date
  3.     StTime = CDate("12:56:05 PM")
  4.     ETime = CDate("1:16:29 PM ")
  5.     MsgBox DateDiff("n", StTime, ETime)
  6.  
Regards
Veena
Jul 1 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.