Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help with time conversion in my query 1

Status
Not open for further replies.

Taecca

Technical User
Jul 20, 2004
59
US
I have the following query:

SELECT tblHostData.Field5 & " " & tblHostData.Field7 AS NYTime, Format(CDate(tblHostData.Field5 & " " & tblHostData.Field7)+ 0.54,"mmm dd"", ""yyyy hh:mm:ss") AS TokyoTime
FROM tblHostData;

It returns:

NYTime TokyoTime
10/05/2004 08:02:40 Oct 05, 2004 21:00:16
10/05/2004 07:59:40 Oct 05, 2004 20:57:16
10/05/2004 07:57:58 Oct 05, 2004 20:55:34
10/05/2004 06:51:02 Oct 05, 2004 19:48:38

As you can see, I am not getting the correct minutes and seconds.

How do I fix my query?

 
Take a look at the DateAdd function.
Or replace 0.54 by n/24 where n is the number of hours to shift.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
GREAT! I used n/24 and it works perfectly.
Thank you very much
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top