Getting the minute from TimeOfDay in Lighting

Hi,

Is there any operation that I can perform to retrieve the minute value of TimeOfDay in the Lighting service?

Thanks.

TimeOfDay is just a string in the format HH:MM:SS. It’s always the same with leading zeros when necessary. So you can just use a substring:

tonumber(string.sub(game.Lighting.TimeOfDay, 4, 5))

Thanks. Is there any reason why there’s a 4 & 5 for the parameters?

Yeah, substring takes a part of the string. In our case starting at index 4 and ending at index 5. HH:MM:SS is the format and MM starts 4 characters in and lasts until the 5th character