Posts: 795
Threads: 136
Joined: Feb 2009
Hi Gintaras, hi all
i'd like to store in a file data, beginning by a date.
Then, i'd like to iterate lines of the file, and delete line older than a defined interval, say 1 month (30 days).
example:
2016-05-02 13:40:21 "some data"
I got the idea from
IStringMap example with DATE as key
Links or code to help?
Thanks
Posts: 12,075
Threads: 141
Joined: Dec 2002
Cannot use Sqlite database?
Then could execute "DELETE FROM table WHERE date<...".
Posts: 795
Threads: 136
Joined: Feb 2009
why, i can't see the connection between my question and your answer, would this involved genuine date management?
Posts: 12,075
Threads: 141
Joined: Dec 2002
Then could execute "DELETE FROM table WHERE date<...". Easier.
Posts: 795
Threads: 136
Joined: Feb 2009
ok, will look, but not sure it fits the bill..
Posts: 12,075
Threads: 141
Joined: Dec 2002
Macro
Macro267
out
str fileData=
;2016-05-02 13:40:21 "one"
;2016-10-02 13:40:21 "two"
;2016-08-02 13:40:21 "three"
;2016-10-12 13:40:21 "four"
DateTime d.FromComputerTime
d.AddParts(-30)
str sDate=d.ToStrFormat("{yyyy-MM-dd} {HH:mm:ss}")
str newData s
foreach s fileData
,if(strcmp(s sDate)<0) continue
,newData.addline(s)
out newData
Posts: 795
Threads: 136
Joined: Feb 2009
Perfexct, as usual, but i must look into sql one of these days, to replace eventually istringmaps routines.
Is sqlite faster than istringmap or icsv? if not, not relevant to switch, but worth knowing the information.
Posts: 12,075
Threads: 141
Joined: Dec 2002
Posts: 795
Threads: 136
Joined: Feb 2009
ok, will stick to istringmap then, no useless conversion .....