问题
I have some csv data I'm trying to plot in gnuplot.
example:
1,2014-11-07T16:00:03+13:00
2,2014-11-07T15:55:03+13:00
3,2014-11-07T15:50:04+13:00
4,2014-11-07T15:45:03+13:00
5,2014-11-07T15:40:03+13:00
6,2014-11-07T15:35:03+13:00
This won't work
set timefmt "%Y-%m-%dT%H:%M:%SZ"
These are New Zealand dates which will change between +12:00 and +13:00
I realise that gnuplot doesn't play nice with timezones. I don't have the option to remove the zone at the source, so how do I set it to just ignore the +13:00 so it's just working in my local time?
回答1:
You can use gnuplot's string functions to remove the time zone part from the data. In this case you don't need to use set timefmt, but the time values are parsed inside the using statement with strptime.
set datafile separator ','
set xdata time
fmt = "%Y-%m-%dT%H:%M:%S"
timeval(s) = strptime(fmt, substr(s, 0, strstrt(s, '+')-1))
plot 'data.csv' using 1:(timeval(strcol(2)))
来源:https://stackoverflow.com/questions/26793373/how-to-ignore-timezone-in-csv-data