Using and os.time

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 ="%I"..":".."%M".." ".."%p")

Obviously I can’t compare a string to a number i.e. If“%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.

this kind of basic question are easy to find with google. try it. First link:

@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 The for loop shows the variables that are returned. The other print statements show how to use them individually.

function setup()"*t")
    for a,b in pairs(d) do
    print("the hour is ",d.hour)
    print("the minute is ",d.min)

You can compare a string to a number if the string contains just a number. Try using tonumber("%l"))

@dave1707 @SkyTheCoder Thanks, I’ve figured out how to do what I was trying to do!