cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JimB-GA Member
Member

adding duration to date

 Hello community.

 

I have a table with one field that is number of days  in it (decimal). I want to add this to a calendar date (01/01/1970).  I have researched all options and am doing something wrong as each effort results in an error.

 

As close as I have been able to get is

[T1] = 17905.72715   This is the number of days since 01/01/1970

 

Date.AddDays(DateTime.FromText("1970-01-01"),[T1])

 

The error returned is "Expression Error: The number is out of range of a 32 bit integer value.  Details: 17905.72715

 

Thanks for advice.

 

Regards

 

Jim B

 

1 ACCEPTED SOLUTION

Accepted Solutions
tarunsingla Established Member
Established Member

Re: adding duration to date

Try changing [T1] to Duration and then simply use + to add DateTime.FromText("1970-01-01") and [T1].Untitled.png

4 REPLIES 4
tarunsingla Established Member
Established Member

Re: adding duration to date

Try changing [T1] to a Whole Number. DateAdd expects a whole number, and not a decimal.

JimB-GA Member
Member

Re: adding duration to date

Is there another function that will accept decimal values?  The resulting value would represent intraday prices and eliminating the decimal portion would result in an inaccurate value.

tarunsingla Established Member
Established Member

Re: adding duration to date

Try changing [T1] to Duration and then simply use + to add DateTime.FromText("1970-01-01") and [T1].Untitled.png

Highlighted
JimB-GA Member
Member

Re: adding duration to date

Thanks very much.  It works.

 

I just have to adjust for time zone and I have the total solution.

 

Jim B

Helpful resources

Announcements
Community News & Announcements

Community News & Announcements

Get your latest community news and announcements.

Summit North America

Power Platform Summit North America

Register by September 5 to save $200

Virtual Launch Event

Microsoft Business Applications Virtual Launch Event

Watch the event on demand for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

MBAS Gallery

Watch Sessions On Demand!

Continue your learning in our online communities.

Users Online
Currently online: 394 members 3,748 guests
Please welcome our newest community members: