wrong os.date?

Hi, do i something wrong

print(os.date("%Y-%m-%d %H:%m:%S", os.time(t)))

                       t.day = t.day + 1        

                       t.hour = 7

                       t.min  = 0

                       t.sec  = 0

print(os.date("%Y-%m-%d %H:%m:%S", os.time(t)));

the day should be one day later, and 7:00:00

but i always get one day later and 7:02:00

???

i can not set the minute… is that a bug

greets

chris

Hi, do i something wrong

print(os.date("%Y-%m-%d %H:%m:%S", os.time(t)))

                       t.day = t.day + 1        

                       t.hour = 7

                       t.min  = 0

                       t.sec  = 0

print(os.date("%Y-%m-%d %H:%m:%S", os.time(t)));

the day should be one day later, and 7:00:00

but i always get one day later and 7:02:00

???

i can not set the minute… is that a bug

greets

chris

Use this as your base function (returns time in seconds)

local function parseTime(dateString) local pattern="(%d+)%-(%d+)%-(%d+)%a(%d+)%:(%d+)%:([%d%.]+)([Z%p])" local xyear,xmonth,xday,xhour,xminute,xseconds=string.match(dateString,pattern) local newTimestamp=os.time({year=xyear,month=xmonth,day=xday,hour=xhour,min=xminute,sec=xseconds}) return newTimestamp end parseTime(os.date("!%FT%XZ"))

You are outputting month for minutes. Lower case leter m is month upper case letter M is minutes.

Hi, @eja, thanks for ur interest to help, but that was not the question :slight_smile:

HI, @primoz.cerar

:slight_smile: thank u, that was exactly the problem… i didnt see the forest because of a lot of trees :slight_smile:

Hi, do i something wrong

print(os.date("%Y-%m-%d %H:%m:%S", os.time(t)))

                       t.day = t.day + 1        

                       t.hour = 7

                       t.min  = 0

                       t.sec  = 0

print(os.date("%Y-%m-%d %H:%m:%S", os.time(t)));

the day should be one day later, and 7:00:00

but i always get one day later and 7:02:00

???

i can not set the minute… is that a bug

greets

chris

Use this as your base function (returns time in seconds)

local function parseTime(dateString) local pattern="(%d+)%-(%d+)%-(%d+)%a(%d+)%:(%d+)%:([%d%.]+)([Z%p])" local xyear,xmonth,xday,xhour,xminute,xseconds=string.match(dateString,pattern) local newTimestamp=os.time({year=xyear,month=xmonth,day=xday,hour=xhour,min=xminute,sec=xseconds}) return newTimestamp end parseTime(os.date("!%FT%XZ"))

You are outputting month for minutes. Lower case leter m is month upper case letter M is minutes.

Hi, @eja, thanks for ur interest to help, but that was not the question :slight_smile:

HI, @primoz.cerar

:slight_smile: thank u, that was exactly the problem… i didnt see the forest because of a lot of trees :slight_smile: