x

Add time to a date?

Hi,

Is there a way to add a certain amount of time to a date, something similar to this:

add_time(date_col, '23:59:59') 
more ▼

asked Jan 25, 2010 at 10:28 AM in Default

user-91 (google) gravatar image

user-91 (google)
3 2 2 2

(comments are locked)
10|1200 characters needed characters left

1 answer: sort voted first

Just add a number. Each day is 1, so to add an hour:

SELECT sysdate+1/24 FROM dual;

or a minute:

SELECT sysdate+1/1440 FROM dual; 
more ▼

answered Jan 25, 2010 at 10:35 AM

Andrew Mobbs gravatar image

Andrew Mobbs
1.5k 1 3

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

New code box

There's a new way to format code on the site - the red speech bubble logo will automatically format T-SQL for you. The original code box is still there for XML, etc. More details here.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x728
x28

asked: Jan 25, 2010 at 10:28 AM

Seen: 919 times

Last Updated: Jan 25, 2010 at 10:28 AM