I am trying to take the hour and minute in the day and assign a value to a variable according to the time of day. As of right now I am recording the time as follows.
time = os.date("%I"..":".."%M".." ".."%p")
Obviously I can’t compare a string to a number i.e. If os.date(“%I”) > 8 then , so I was wondering how I could accomplish my goal. Also, I’m a little confused in how os.time works so I thought I’d throw that in here for anyone who would like to explain it to me.
@Jmv I know it is pretty basic, but I did look it up on google first and 1. I couldn’t find anything specifically aimed at my question (this wasn’t exactly what I was going for, but after re-reading the page a couple of times, I think I know what to do now) and 2. I thought it would be good to start a thread on it in codea so people could just search the forum as that’s where I usually look first.
@Staples Here’s an example of using os.date. The for loop shows the variables that are returned. The other print statements show how to use them individually.
function setup()
d=os.date("*t")
for a,b in pairs(d) do
print(a,b)
end
print()
print("the hour is ",d.hour)
print("the minute is ",d.min)
end