I've borrowed this code from the reference pages but it doesn't seem to work.
void setup(){
time_t time = Time.now();
Time.zone(-8); // setup a time zone
Time.setFormat(TIME_FORMAT_DEFAULT);
}
My timestamps still show as ISO in the console logs.
Also, it would be nice if the time passed in the webhook {{PARTICLE_PUBLISHED_AT}} was also the same format.
This field is not sent by your device but added by the cloud.
If you want to have the “local” format, you’ll need to send that in the payload (data
).
If you Serial.print(Time.format())
you may see that `Time.setFormat() actually works, it’s just not used for that field of your published event.
After all, that field is used by many endpoints and can’t be allowed to mutate just as any user likes. You could even set a format that doesn’t represent a date time at all, what then?
1 Like