Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/06/23 11:29
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
7 registered members (3run, miwok, AndrewAMD, Quad, TipmyPip, fairtrader, 1 invisible), 637 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
string date to DATE format #479813
04/27/20 18:29
04/27/20 18:29
Joined: Jun 2018
Posts: 3
G
ganimedes Offline OP
Guest
ganimedes  Offline OP
Guest
G

Joined: Jun 2018
Posts: 3
Hello. I'm trying to create a dataSet of just 1 record with some data in T6 format. So I use the dataNew function that provides me a pointer

T6 *t = dataNew(1, 1, 7); // Handler 1, 1 record, 7 fields

I assign the pointer to a T6 struct. Then try to fill it with some OHLC data. The first one is the date so I try:

t->time = ...

but I don't know how to convert a string containing the current date (example 2020-04-27 00:00) to the DATE format. According to documentation: The DATE format is equivalent to a double / var variable and counts the number of days since 12-31-1899 with a resolution of ~ 1 µsec.

To provide some context (maybe I'm not following the right path) I'm trying to add a OHLC row to an existing t6 file. My idea to achieve this is:

1. dataLoad of the existing t6 file to create a dataSet in memory

2. create a new dataset with 1 record

3. populate it with today's OHLC data

4. dataAppend of the second dataset to the first one

5. dataSave of the first dateset with the added row

Thanks in advance

Re: string date to DATE format [Re: ganimedes] #479821
04/28/20 09:35
04/28/20 09:35
Joined: Jul 2000
Posts: 27,967
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,967
Frankfurt
For the current date, use t->time = wdate(NOW);.

https://manual.zorro-project.com/month.htm

Re: string date to DATE format [Re: ganimedes] #479851
05/01/20 07:57
05/01/20 07:57
Joined: Jun 2018
Posts: 3
G
ganimedes Offline OP
Guest
ganimedes  Offline OP
Guest
G

Joined: Jun 2018
Posts: 3
Thanks.

I finally use wdatef("%Y%m%d", dateToday) , where dateToday is a string containing the current day.

Yours is much shorter!


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1