I created a script to write a file with some fields, and one of them is TimeCurrent(). But the problem is that it is returning to me a number that I cannot translate to date in other programs (e.g. R, Excel, Calc OpenOffice).
This a sample of the numbers that it returns:
1422013200 1422013801 1422014100 1422014401 1422014701
This is the list of fields in my file:
2009475830 1422015001 12345 1 EURUSD 1.12239 PERIOD_M5 2009476703 1422015300 12345 1 EURUSD 1.12336 PERIOD_M5 2009477514 1422015610 12345 1 EURUSD 1.12341 PERIOD_M5
From my code, timecurrent() should be the second column, right?
My Excel is quite old now so not sure if there is a difference with newer versions.
But your code that you posted will not separate the data into different columns.
It will if you change the delimiter to a ","
filehandle=FileOpen("opens.csv",FILE_CSV|FILE_READ|FILE_WRITE, ",");
Also, TimeCurrent()is output to file as a string, not a number , so how is it appearing in your file as a number?
It should be output as 2015.01.23 12:10:01
This makes me think that the code that you have posted is not the code that you have used.
My Excel is quite old now so not sure if there is a difference with newer versions.
But your code that you posted will not separate the data into different columns.
It will if you change the delimiter to a ","
Also, TimeCurrent()is output to file as a string, not a number , so how is it appearing in your file as a number?
It should be output as 2015.01.23 12:10:01
filipefr: I created a script to write a file with some fields, and one of them is TimeCurrent(). But the problem is that it is returning to me a number that I cannot translate to date in other programs (e.g. R, Excel, Calc OpenOffice).
This a sample of the numbers that it returns:
1422013200 1422013801 1422014100 1422014401 1422014701
- 1422014100 is Fri, 23 Jan 2015 11:55:00 GMT according to Online Conversion - Unix time conversion
- So stop outputting a number. Convert the datetime to a string that the other programs can read.
Remove #property strict, and it will write a number. Which is also the answer to OP question
Yet another example of the documentation being incomplete!
Numbers of the datetime type are displayed as "YYYY.MM.DD HH:MI:SS".
Nowhere does it state that it will display a number if #property strict is removed.
Yet another example of the documentation being incomplete!
Numbers of the datetime type are displayed as "YYYY.MM.DD HH:MI:SS".
Nowhere does it state that it will display a number if #property strict is removed.
You are certainly right about the documentation, but this is how datetime where "displayed" before build 6xx, and not using #property strict means you will use the "old" compiler.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I created a script to write a file with some fields, and one of them is TimeCurrent(). But the problem is that it is returning to me a number that I cannot translate to date in other programs (e.g. R, Excel, Calc OpenOffice).
This a sample of the numbers that it returns:
And these are some outputs from Google Spreadsheets and Open Office. Neither of them represent the true date which shoud been (jan,21,15 or jan,20,15)
This is my code: