lua-users home
lua-l archive

Re: lua how to get current and previous day

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


2010年9月14日 Natanael Copa <natanael.copa@gmail.com>:
> On Tue, Sep 14, 2010 at 3:10 PM, Ted Unangst <ted.unangst@gmail.com> wrote:
>> Option 1:
>> now = os.time()
>> yesterday = now - 3600*24
>> print(os.date("...", yesterday))
>
> This might give you weird bugs once in a while as it wrongly assumes
> that a day is always 3600 * 24 hours. You need take leap years and
> leap seconds in consideration.
And what happens at tz conversions (summer time <-> winter time)?
Best
 Martin

AltStyle によって変換されたページ (->オリジナル) /