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

How to convert time in seconds to date and time using Convert

100+
P: 347
I have the following sql query:

Expand|Select|Wrap|Line Numbers
  1. SELECT [Employees].name, [Employees].Employeenumber,
  2. Convert ([Timestamp]-([LoggedIn]/1000)/60))/1440+1,"mm/dd/yy"as [DATE],
  3. FROM Employees INNER JOIN mOpInterval ON [Employees].Loginname1 = mOpInterval.Opname
  4.  
The data in the (timestamp) and (loggedin) fields are in seconds and I'm trying to convert them to date and time. When I try to run this query I get this error:

Server: Msg 170, Level 15, State 1, Line 2
Line 2: Incorrect syntax near '-'.

and I know that it's because of the syntax of my query. Can anyone please tell me the best way to re-write this query to get the results that I am looking to get.

Thank you

Doug
Sep 27 '10 #1

✓ answered by ck9663

I think you need to re-arrange your parenthesis...

Happy Coding!!!

~~ CK

Share this Question
Share on Google+
1 Reply


ck9663
Expert 2.5K+
P: 2,878
I think you need to re-arrange your parenthesis...

Happy Coding!!!

~~ CK
Oct 1 '10 #2

Post your reply

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