Date, String and Julian Conversion problems

Questions about MultiCharts and user contributed studies.
Emerald King
Posts: 10
Joined: 17 Nov 2005
Has thanked: 2 times

Date, String and Julian Conversion problems

Postby Emerald King » 13 Oct 2010

Hello Multicharts Support,

When I use StringToDate("01/03/1977") it returns 28128.00
When I use DateToJulian(28128.00) it returns 1002.00
When I use JulianToDate(1002.00) it returns 20928.00
When I use DateToString(20928.00) it returns 4/18/1957

Is this a bug or do I not understand how to convert dates?

Thank you for your Time
EK

bowlesj3
Posts: 2180
Joined: 21 Jul 2007
Has thanked: 227 times
Been thanked: 429 times

Re: Date, String and Julian Conversion problems

Postby bowlesj3 » 13 Oct 2010

I never use them but I would assume you use the corresponding format to add or subtract dates. After the addition/subtraction of the number version you convert it back.

Emerald King
Posts: 10
Joined: 17 Nov 2005
Has thanked: 2 times

Re: Date, String and Julian Conversion problems

Postby Emerald King » 13 Oct 2010

Hello Bowlesj3,

Thanks for taking the time to respond to my query
I am not adding nor subtracting anything

I am just trying to convert a string date to date then date to a Julian date and then back.
It should convert back to the same date right, but it doesn't.

Thanks
EK

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: Date, String and Julian Conversion problems

Postby TJ » 13 Oct 2010

Hello Multicharts Support,

When I use StringToDate("01/03/1977") it returns 28128.00
...
Thank you for your Time
EK
does 28128.00 look like a date to you?


hint: the answer is in the manual.

Emerald King
Posts: 10
Joined: 17 Nov 2005
Has thanked: 2 times

Re: Date, String and Julian Conversion problems

Postby Emerald King » 13 Oct 2010

Hello TJ,

Thanks for responding to my post.

to answer your question yes,


Example
StringToDate("01/01/2008") will return a value of 39448.00000000, corresponding to the specified date of January 1st, 2008

StringToDate("04/04/99") will return a value of 36254.00000000, corresponding to the specified date of April 4th, 1999

so 28128.00 to me does look like a date

Am I missing something?

Thanks
EK

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: Date, String and Julian Conversion problems

Postby TJ » 13 Oct 2010

Hello TJ,

Thanks for responding to my post.

to answer your question yes,


Example
StringToDate("01/01/2008") will return a value of 39448.00000000, corresponding to the specified date of January 1st, 2008

StringToDate("04/04/99") will return a value of 36254.00000000, corresponding to the specified date of April 4th, 1999

so 28128.00 to me does look like a date

Am I missing something?

Thanks
EK
the keyword is deceptive. (I know, blame it on EL)

Here's what's in the [F1] help:
StringToDate

Returns the integer portion of a double-precision decimal DateTime value, corresponding to the specified date.


This is not a date per se.
You are getting a DateTime value,
ie. a serial number of the date/time.

28128.00 refers to the 28,128th day since 1900.

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: Date, String and Julian Conversion problems

Postby TJ » 13 Oct 2010

Hello Multicharts Support,

...
When I use DateToJulian(28128.00) it returns 1002.00
...
Is this a bug or do I not understand how to convert dates?

Thank you for your Time
EK
the "Date" in DateToJulian is NOT the same "Date" as in StringToDate.

:-(

again, from the [F1] help:
DateToJulian

...
The date is specified in the YYYMMdd format, where YYY is the number of years since 1900, MM is the month, and dd is the day of the month.

Emerald King
Posts: 10
Joined: 17 Nov 2005
Has thanked: 2 times

Re: Date, String and Julian Conversion problems

Postby Emerald King » 13 Oct 2010

ok Thanks TJ for the clarification :)

albevier
Posts: 24
Joined: 13 Nov 2005
Has thanked: 5 times
Been thanked: 3 times

Re: Date, String and Julian Conversion problems

Postby albevier » 11 Dec 2019

For future readers of this thread, this MC WIKI page provided much of the information I needed.

https://www.multicharts.com/trading-sof ... syLanguage


Return to “MultiCharts”