Date/Time function

Aliq2014

New Member
Joined
Sep 10, 2014
Messages
46
Hello All,

I'm looking for date and time from the below formula:

SELECT (dateadd(hour,datediff(hour,getutcdate(),getdate()),dateadd(s,JNL.DATE_DAY,convert(datetime,'1990-01-01 00:00:00',102)))) as Date
From JNL

I get the following error "Argument data type date is invalid for argument 2 of dateadd function". Would someone please advise? I'm new to programming.

Thanks,

Ali
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Select
Date_Day
From
JNL

formatting would be the next step

convert(varchar(11),Date_Day,103) As [Date]
produces a English Date that's just one way, depends on what is stored n the file
 
Upvote 0
Thank you Mole999, that field has a time as well is there a way I can pull the date and time (e.x. 2015-10-31 00:00:00)
 
Upvote 0
Thank you. I'm using PowerPivot query design and received an error. "datepart is not supported by date function datepart for data type date (Microsoft SQL Server error:9810)
 
Upvote 0
I know nothing about powerpivot
 
Upvote 0

Forum statistics

Threads
1,221,848
Messages
6,162,415
Members
451,762
Latest member
Brainsanquine

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top