Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

increment timestamp by 24 hours

Posted on 2014-10-06
3
Medium Priority
?
115 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 66

Accepted Solution

by:
Jim Horn earned 2000 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 49

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

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

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…
In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

715 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