Solved

increment timestamp by 24 hours

Posted on 2014-10-06
3
89 Views
Last Modified: 2014-10-17
hi experts

I have table USERLOCK
something like
Id        Lockedtime
1      2014-10-06 15:01:25.170

In my sql i need to return Lockedtime as 2014-10-07 15:01:25.170  (2014-10-06 15:01:25.170 + 24 hours )

select ID, Lockedtime+24 from USERLOCK 

Open in new window

doesnt seem to work , it increments by 24 days
any clue how i can increment the time by 24 hours?

thanks
0
Comment
Question by:royjayd
3 Comments
 
LVL 65

Accepted Solution

by:
Jim Horn earned 500 total points
ID: 40364496
select ID, DATEADD(day, 1, Lockedtime) as Lockedtime from USERLOCK

Datetime values are stored internally as a double, where 1=a single day, so doing a +24 to a datetime would be the equialent of DATEADD(day, 24, Lockedtime).
0
 

Author Comment

by:royjayd
ID: 40364721
thanks
0
 
LVL 48

Expert Comment

by:PortletPaul
ID: 40365280
Just in case this is for a MySQL Timestamp field*

DATE_ADD(Lockedtime, INTERVAL 24 HOUR)

or

DATE_ADD(Lockedtime, INTERVAL 1 DAY)

----
:) * these might indicate MySQL: "timestamp" that means a date & time and "my sql"
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There have been several questions about Large Transaction Log Files in SQL Server 2008, and how to get rid of them when disk space has become critical. This article will explain how to disable full recovery and implement simple recovery that carries…
SQL Server engine let you use a Windows account or a SQL Server account to connect to a SQL Server instance. This can be configured immediatly during the SQL Server installation or after in the Server Authentication section in the Server properties …
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now