Page 1 of 1
Day of year - Date
Posted: Tue Feb 28, 2023 8:26 pm
by brjohnsmith
Hi, how to convert day of year to date? thx
Re: Day of year - Date
Posted: Wed Mar 01, 2023 7:08 pm
by Lech Kulikowski
Hello,
You can use the following expression:
{DateSerial(2023,1,1).AddDays(dayOfYear - 1)}
Thank you.
Re: Day of year - Date
Posted: Thu Mar 02, 2023 12:27 am
by brjohnsmith
Hi Lech Kulikowski, it worked, however, I have a new challenge.
Suppose that the year is a string (that was taken using Substring function), and has 2 digits, it means, the Substring returns 23. I am supposing that the year must be decimal and 4 digits, and as it is returning string, I need to convert it in decimal. I tried to use (decimal) before the Substring, but it didn't work, because I was concatenated 20+(decimal) Substring(xx,4,2).
A new question, will this function support leap year?
thx
Re: Day of year - Date
Posted: Fri Mar 03, 2023 3:49 pm
by Lech Kulikowski
Hello,
You can use the following expression:
{DateSerial(int.Parse(Substring(Variable1,2,2)),1,1).AddDays(dayOfYear - 1)}
Thank you.