Purchased an Imp 003 from Mouser and have moved working code onto it from an April Board. In the code, I calculate the month, day, year, weekday and day of the year using the date() function. The code works on the agent side of April, Amber, and Imp 003 boards (on your servers), however, on the device side of all three boards, the calculation of yday always yields 0. The other date() values seem to be correct.
The code is below:
local currentTime = date(time(), 'u');
local currenthour = currentTime.hour ;
local currentmin = currentTime.min ;
local currentday = currentTime.day;
local currentwday = currentTime.wday
local currentmonth = currentTime.month + 1;
local currentyear = currentTime.year;
local dayofyear = currentTime.yday;
server.log(format("Device: Day of Year (%u, %u)", dayofyear, currentTime.yday ) );
I have tried using:
local currentTime = date();
But it doesn't affect the day of the year value.