Gamestudio Links
Zorro Links
Newest Posts
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (AbrahamR, 7th_zorro, dr_panther, 1 invisible), 702 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 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,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
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