MBS ChartDirector TimeDate Conversion

Some of my data is in Xojo’s TimeDate data type. ChartDirector uses the Double data type for dates and times. I am having difficulty converting data types. My conversion is giving me the wrong year. Here is my code:

Var today As DateTime = DateTime.now // Aug 15, 2022
Var xValue As Double = today.SecondsFrom1970
c.xAxis.getFormattedLabel(xValue, "mmm dd, yyyy") // Results as  Aug 15, 0053

Any help would be appreciated.

You can use

And there in documentation you see it’s seconds since year 1.
Like you could do the function above for 1. Jan 1970 and add that value.

Thank you Christian! This modified code does the trick:

Var today As DateTime = DateTime.now // Aug 15, 2022
Var xValue As Double = today.SecondsFrom1970 + 6.213558e+10
c.xAxis.getFormattedLabel(xValue, "mmm dd, yyyy") // Results correctly as  Aug 15, 2022