Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSV time output format #23

Open
TrystanLea opened this issue Jul 17, 2018 · 1 comment
Open

CSV time output format #23

TrystanLea opened this issue Jul 17, 2018 · 1 comment

Comments

@TrystanLea
Copy link
Member

In the forum thread https://community.openenergymonitor.org/t/timestamp-issue-when-importing-csv-exported-data-from-emoncms-org-feeds-list/7863/19 we discussed time stamp formats for the CSV output in the graphs module.

Do we need to amend the available output format?

The output format is defined here https://github.com/emoncms/graph/blob/master/graph.js#L837

I’ve been using “2017-03-14 00:00:00” format for a long time, Im not entirely sure why TBH, perhaps because it contains everything you need in a condensed format?

I usually convert Unix time stamp to this format with:

$datestr = date("Y-m-d H:i:s",time());

luckily php’s strtotime converts a large variety of time formats back to unix time :slight_smile: I dont really have a strong opinion on this either way

@borpin
Copy link

borpin commented Jul 17, 2018

The problem, as seen, is that this is ambiguous in that there is no indication of the timezone and could easily be interpreted as local time by an external processor (which in the absence of a timezone many will do). If the data was fed back in, would strtotime assume it was local rather than UTC? Just tested it and strtotime doesn't actually like this format.

I'd prefer:

$datestr = date(DATE_ISO8601);

Or even make the format user configurable 😄 That would of course help anyone who wants it in the current format.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants