How can I count days from 1. January 2000 until today?

Hello, my challenge is to finde out how I can count from the first day of this century until now.

FirstDateOFCentury = ?           <--- Here I need your help
Now = Date();
Difference = Now - FirstDateOFCentury;

Do you have any ideas?

Did you search the forum or manuel before posting?

See DateTimeDiff.

Many thanks for you link. I've researched, but not found. In your link is not a hint to define the 1. January 2000.

@EveryDayBetter there are probably different ways to calculate this. I assume you want the number of calendar days not the number of trading days? Most stock markets are closed on weekends and holidays so the two numbers are very different.

One possible helpful Knowledge Base article

Another possible solution

// I didn't document where this idea came from
// but I am pretty certain I did not originally code this concept

startdt	= StrToDateTime( "2000-01-01" );
enddt 	= StrToDateTime( "2023-03-17" );

DifferenceInDays = floor( DateTimeDiff( enddt, startdt )/(24*60*60) );

Produced this in an exploration (I do not know if it is correct)
image

Thank you very much, this was helpful for me.

// I didn't document where this idea came from
// but I am pretty certain I did not originally code this concept

startdt	= StrToDateTime( "2000-01-01" );
enddt 	= StrToDateTime( Date() );

ConvertCalendarDaysToTradingDays = 250 / 365;
DifferenceInDays = floor( DateTimeDiff( enddt, startdt )/(24*60*60) * ConvertCalendarDaysToTradingDays);

@EveryDayBetter it looks like you want the number of "trading bars" and not calendar days. So a variety of possible solutions for that had been discussed before.

1 Like

Thank you very much.