yyJJJ date format

Hello all.

I need to input a date format yyJJJ, where yy=year and JJJ=day.
For example:

Today’s date is 29-Nov-2018
Today’s Julian Date is 18333

I’ve tried to use the function DateToJulian, but the result is totally different.

Is there a way to return a date format like this?

BR,
A. Ferreira

Your date is not actually a Julian Date (which is defined as the number of days that passed since a certain start day in the past). However, getting your result is very easy ;):

ToString$(Year(Today())-2000)+ToString$(Int(DateDiff(Today(), DateYMD(Year(Today()),1,1)))+1)

OK, in words: first of all, take today’s year and subtract 2000 (in order to get to “18”, different windowing would also be possible of course) and format it as a string. The second part is harder - it uses a DateDiff in order to get the number of days between today and Jan. 1st this year (i.e. it returns the day of year). As you wanted to get “333”, it’s adding one more day. In order to get rid of fractions, it uses an Int() function and then - as you want to concatenate it to the “18”, converts it to a string as well. Thanks for this very interesting challenge!

2 Likes

Hi Günther!
How are you?

Ok, let me ask you another thing.
I have a varible called @Date where returns the system date from our internal software.

I could use the varible inside this string?

The date format from this varible is dd/mm/yyyy

Thanks so much for your feedback! :slight_smile:

Try to replace Today() in my formula with Date(@Date). Not sure if the format will be parsed correctly, if not I can figure that out tomorrow when I’m back at work…