Solved

increment timestamp by 24 hours

Posted on 2014-10-06
3
85 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
Comment Utility
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
Comment Utility
thanks
0
 
LVL 48

Expert Comment

by:PortletPaul
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Hi all, It is important and often overlooked to understand “Database properties”. Often we see questions about "log files" or "where is the database" and one of the easiest ways to get general information about your database is to use “Database p…
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 …
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

772 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

10 Experts available now in Live!

Get 1:1 Help Now