Calculate number of days since a specific date

Hello,

Is it possible to calculate in a script the number of days elapsed since a specific date until today?

Thank you
Marc

Hi,

Yes, this can be done, here is an example using Jan 8 2024:

//Set Date to Count From
V1 = STRDATE(DATE=2024-01-08) ;
V2 = BARDATE() ;
//Set Boolean for when selected date occurs
V3 = V2 == V1;
//Count the number of days since selected date
TIMESINCESIGNAL(V3, UNIT=Days)

Note this counts Calendar Days, not Bars, if you wanted bars you can change the Unit type being used on the last line.

1 Like