06-22-2020 07:07 PM - edited 06-22-2020 07:10 PM
Hi,
I want to generate the Day Number of the Year, currently I was able to generate the day of the week of any date, input the date and the out put will be Tuesday, Monday, etc.
How can I generate the day number like 06/22/2020 = 174 or 07/01/2020 = 183 etc. and keep account of the leap year of any date? any ideas or feedback are appreciated!
Thanks
Solved! Go to Solution.
06-22-2020 07:29 PM - edited 06-22-2020 07:46 PM
How old is that code? The format of the "date time rec" cluster has changed decades ago, so I recommend to use the current version.
See if this works for you:
(I am not sure why you have a while loop without any wait. I doublet it is necessary to recalculate the same input millions of times per second)
06-22-2020 07:45 PM
Thank you for your help. the code is exactly what I need!
06-22-2020 08:47 PM
@altenbach wrote:
How old is that code? The format of the "date time rec" cluster has changed decades ago, so I recommend to use the current version.
See if this works for you:
(I am not sure why you have a while loop without any wait. I doublet it is necessary to recalculate the same input millions of times per second)
That code could be reduced to the size of a couple of postage stamps. Somebody wise once said, do more with less. All you need is the %j specifier.
mcduff
06-22-2020 09:00 PM - edited 06-22-2020 09:12 PM
@mcduff wrote:
How do you enter an arbitrary day/month/year into the three given controls??
(e.g. for 07/01/2020 = 183)
06-22-2020 09:12 PM
@altenbach wrote:
How do you enter an arbitrary day/month/year into the three given controls??
I did not enter anything into the controls. It can be done like below, just use %j for Julian Day; this is pretty close to the OP's original request, a string result.
mcduff
PS Sorry, didn't mean to insult, just some playful teasing.
06-22-2020 09:27 PM - edited 06-22-2020 09:40 PM
@mcduff wrotePS Sorry, didn't mean to insult, just some playful teasing.
Oh, no insult felt here 🙂 Always enjoy creative wording. 🙂
I would argue that unbundling "day of year" is easier to read for most. Code size is similar. It also depends if we want a numeric or string.