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

Format Of Time Difference

P: n/a
I'm trying to express the difference between two Date/Time fields as
Hours:Minutes in the query grid by using:

MoveTime: DateDiff("h",[MoveFrom],[MoveTo]) & ":" & (DateDiff("n",
[MoveFrom],[MoveTo]) Mod 60)

This almost works except a difference of 2 hours and 7 minutes
displays as "2:7" instead of "2:07". Is there a way that I can force
the query to display the required format?

Any help is appreciated.

Feb 6 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Try:
MoveTime: DateDiff("h",[MoveFrom], [MoveTo]) &
Format(DateDiff("n", [MoveFrom], [MoveTo]) Mod 60, "\:00")

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Wayne" <cq*******@volcanomail.comwrote in message
news:11*********************@l53g2000cwa.googlegro ups.com...
I'm trying to express the difference between two Date/Time fields as
Hours:Minutes in the query grid by using:

MoveTime: DateDiff("h",[MoveFrom],[MoveTo]) & ":" & (DateDiff("n",
[MoveFrom],[MoveTo]) Mod 60)

This almost works except a difference of 2 hours and 7 minutes
displays as "2:7" instead of "2:07". Is there a way that I can force
the query to display the required format?

Any help is appreciated.
Feb 6 '07 #2

P: n/a
Thanks Allen. It works perfectly.

Feb 6 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.