4
How to get the last weekend of the month of March to change your time to daylight saving time.
Code to identify if it is the month of March and if it is a Sunday.
month_now=os.date("%m")
week_day=os.date("%w")
if week_day=="7" then
print("domingo")
end
if month_now=="03" then
print("Março")
end
I have my doubts whether I should do this to find out about daylight savings, it doesn’t seem to be a reliable criterion. Apart from that, you need to know what the last week of the month is. Is it the last one that starts in the month? Is it the last one that ends in it? What day is used to determine the beginning of the week?
– Maniero
Exactly, I need to know the last week of that month. From what I saw there is no such language as we can know the week.
– akm
Exactly what? I think you didn’t read what I wrote and mainly I asked. Without defining the concept will give you wrong result. Although I reaffirm that you are probably already using the wrong method to set daylight saving time.
– Maniero
What is the best method to use?
– akm
Daylight saving time is set annually. It makes no sense to ask this question, if you go to Brazil.
– Bacco