Agent clock off

My agent delivers strange timestamps.
Date gives me 4/11/2014 19:37 so it’s about two months off.

local time = date(time()+3600, ["day", "month", "year", "hour", "min"]); local snd_str = "sql=INSERT INTO "+codes.table_id+" (Time, Temp, Light, Activity) VALUES ('"+time.day+"/"+time.month+1+"/"+time.year+" "+(time.hour)+":"+format("%i", time.min)+......)"; server.log(snd_str);

The code had no problems of this kind the last time i ran in, in november.

A couple things to note:

  1. You’re overwriting the time() function with your time variable, which means you won’t be able to call this more than once.

  2. Your date/time error looks like it’s actually a typecasting error. You’re doing a bunch of string concatenation - including time.month + 1, which I suspect is turning into “1” + 1 = 11.