ComputerDateTime is wrong  [SOLVED]

Questions about MultiCharts and user contributed studies.
User avatar
PaperoneJunior
Posts: 6
Joined: 24 Mar 2021
Has thanked: 2 times

ComputerDateTime is wrong

Postby PaperoneJunior » 15 Feb 2023

From the documentation:
The integer portion of the DateTime value indicates the number of days that have elapsed since January 1st, 1900
This is not true. Today, when I'm writing this post, google (or Matlab ecc.) tells that from January 1, 1900 – February 15, 2023 are anlapsed 44,970 days.
If I print ComputerDateTime in the powerlanguage editor I see 44972!

There are 2 days more!

How is it possible?

Here is the documentation ref:
https://www.multicharts.com/trading-sof ... erDateTime

User avatar
Kate MultiCharts
Posts: 591
Joined: 21 Oct 2020
Has thanked: 9 times
Been thanked: 148 times

Re: ComputerDateTime is wrong  [SOLVED]

Postby Kate MultiCharts » 15 Feb 2023

Hello PaperoneJunior,

Thank you for bringing it to our attention!

You're right, the number of days is calculated since December 30th, 1899.
We corrected the info in the Wiki.

User avatar
PaperoneJunior
Posts: 6
Joined: 24 Mar 2021
Has thanked: 2 times

Re: ComputerDateTime is wrong

Postby PaperoneJunior » 15 Feb 2023

Many thanks for your reply!
Regards,
Davide

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1544 times
Been thanked: 1565 times
Contact:

Re: ComputerDateTime is wrong

Postby JoshM » 17 Feb 2023

You're right, the number of days is calculated since December 30th, 1899.
We corrected the info in the Wiki.
But isn't this a bug?

It seems strange to me that PowerLanguage starts counting days since December 30th and not since January 1st. That is not easy to work with at all. Is this how it's supposed to work in both PowerLanguage and EasyLanguage?

I see that all relevant wiki pages have been updated to 'December 30th, 1899' but I fear that we're just documenting a bug here. Instead of taking a pause and thinking through if this behaviour perhaps needs to be fixed.

User avatar
Kate MultiCharts
Posts: 591
Joined: 21 Oct 2020
Has thanked: 9 times
Been thanked: 148 times

Re: ComputerDateTime is wrong

Postby Kate MultiCharts » 17 Feb 2023

You're right, the number of days is calculated since December 30th, 1899.
We corrected the info in the Wiki.
But isn't this a bug?

It seems strange to me that PowerLanguage starts counting days since December 30th and not since January 1st. That is not easy to work with at all. Is this how it's supposed to work in both PowerLanguage and EasyLanguage?

I see that all relevant wiki pages have been updated to 'December 30th, 1899' but I fear that we're just documenting a bug here. Instead of taking a pause and thinking through if this behaviour perhaps needs to be fixed.
Hello JoshM,

EasyLanguage also uses December 30, 1899 as day 0. For example, please see the TS's DateTime description here.
If you experience any specific issues with the keywords in question, please let us know.


Return to “MultiCharts”