+1 800 256 3608 (toll-free in North America) or +49 7531 90 60 10| service@combit.com

yyJJJ date format

designer

(Amanda Ferreira) #1

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


(Günther Schwarze) #2

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!


(Amanda Ferreira) #3

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:


(Günther Schwarze) #4

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…