Home  Contents

datetime:isdst

Date/Time Core4 Lua Commands

SYNOPSIS

  1. flag = datetime:isdst()
  2. seconds = datetime:offset()
  3. name = datetime:zone()

DESCRIPTION

Assuming that datetime contains local date/time, these functions are used to query information about the stored value.

RETURN VALUE

datetime:isdst() returns a boolean, indicating whether the stored date/time lies within a range where daylight saving rules are in effect.

datetime:offset() returns the offset of the stored local time to UTC, taking daylight saving rules into account.

datetime:zone() returns the name of the time zone of the stored value, which might differ depending if daylight saving is in effect or not (e.g. CET vs. CEST).

ERRORS

Raises an error if datetime is not a datetime instance.

All functions return nil if datetime is not a local date/time.

EXAMPLE

>  > 
dt = clock.currentDateTime():toLocal() print (dt, dt:isdst(), dt:offset(), dt:zone())
2009-08-06T13:07:14 true 7200 CEST

SEE ALSO