Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages


home | help
DateTime::TimeZone::LMUser Contributed Perl DocumentDateTime::TimeZone::LMT(3)

       DateTime::TimeZone::LMT - A Local Mean Time time	zone for DateTime

       This documentation refers to DateTime::TimeZone::LMT version 1.01.

	 use DateTime::TimeZone::LMT;

	 # Somewhere in	Hawaii
	 my $tz_lmt = DateTime::TimeZone::LMT->new(
	   longitude =>	-174.2342

	 $now =	DateTime->now( time_zone => $tz_lmt );

	 my $tz_office = DateTime::TimeZone::LMT->new(
	   name	=> 'Office',
	   longitude =>	-174.2343


	 $now =	DateTime->now( time_zone => 'Office' );

	 # Office

	 # Relocate office to the neighbourhood	of Volgograd
	 $tz_office->longitude(	45.123 );
	 # 45.123

	 # 45.123

       This module provides a 'Local Mean Time'	timezone for DateTime. Using
       it you can determine the	Mean Time for any location on Earth. Note
       however that the	Mean Time and the Apparent Time	(where the sun is in
       the sky)	differ from day	to day.	This module may	account	for Local
       Apparent	Time in	the future but then again, the Solar:: modules will
       probably	be a better bet.

       If you want more	information on the difference between LMT and LAT,
       search the www for 'equation of time', 'analemma' or 'ephemeris'.

       (Shameless plug-in) You can for example take a look at the example text
       sun.pdf in the repository <>.

       This module has the following constructor:

       o   new(	longitude => $longitude_float, name => $name_string )

	   Creates a new time zone object usable by DateTime. The zone is
	   calculated to the second for	the given longitude.

	   Eastern longitudes are positive: 0 to +180.

	   Western longitudes are negative: -180 to 0.

	   An optional name can	be given in order to distinguish between
	   multiple instances. This is the long	name accessable	via DateTime.

       "DateTime::TimeZone::LMT" objects provide the following accessor

       o   offset_for_datetime(	$datetime )

	   Given an object which implements the API, this method
	   returns the offset in seconds for the given datetime. For Olson
	   time	zones, this takes into account historical time zone
	   information,	as well	as Daylight Saving Time.  The offset is
	   determined by looking at the	object's UTC Rata Die days and
	   seconds. For	LMT time zones,	the historical data and	DST are

       o   offset_for_local_datetime( $datetime	)

	   Given an object which implements the API, this method
	   returns the offset in seconds for the given datetime.  Unlike the
	   previous method, this method	uses the local time's Rata Die days
	   and seconds.	 This should only be done when the corresponding UTC
	   time	is not yet known, because local	times can be ambiguous due to
	   Daylight Saving Time	rules.

       o   name( $new_name_string )

	   Returns the name of the time	zone.  This is "Local Mean Time"
	   unless the contructor specifies a different name.

	   If a	new name is given, then	the object will	be changed before
	   being returned.

       o   longitude( $new_longitude_float )

	   Returns the longitude of the	time zone.  This is the	value
	   specified in	the constructor.

	   If a	new longitude is given,	then the object	will be	changed	before
	   being returned.

       o   short_name_for_datetime( $datetime )

	   Returns 'LMT' in all	circumstances.

	   It is strongly recommended that you do not rely on short names for
	   anything other than display.

       o   create_alias( $alias_name );

	   Creates an alias that can be	called as a string by DateTime

	   This	means you can "$dt = DateTime->new( time_zone => 'LMT' )" or
	   "$dt	= DateTime->new( time_zone => 'my alias' )" rather than	the
	   normal "$dt = DateTime->new(	time_zone => $lmt )". This is of
	   little benefit unless you're	accepting a time zone name from	a

	   If the optional $alias_name is provided then	that will be the alias
	   created. Otherwise the alias	is 'LMT'. Multiple aliases can be
	   created from	the one	object.

	   If the longitude is changed after an	alias is created, then the
	   alias WILL NOT CHANGE. The alias does not behave as an instance of

   Compatability methods
       The following methods always return the same value. They	exist in order
       to make the LMT time zone compatible with the default
       "DateTime::TimeZone" modules.

       o   is_floating

	   Returns false (0) in	all circumstances.

       o   is_utc

	   Returns false (0) in	all circumstances.

       o   is_olson

	   Returns false (0) in	all circumstances.

       o   category

	   Returns 'Solar' in all circumstances.

       This class also contains	the following function:

       o   offset_at_longitude(	$longitude )

	   Given a longitude, this method returns a string offset.

       This module depends on basic DateTime modules: DateTime and
       DateTime::TimeZone.  It depends also on Params::Validate.

       No known	bugs.

       Support for this	module is provided via the email
       list.  See <> for more details.

       Please submit bugs to the CPAN RT system	at
       or via email at

       Rick Measham <> with parts	taken from DateTime::TimeZone
       by Dave Rolsky <>.

       Co-maintainer: Jean Forget (JFORGET at cpan dot org).

       Copyright (C) 2003, 2016	Rick Measham and Jean Forget.  All rights
       reserved.  This program is free software; you can redistribute it
       and/or modify it	under the same terms as	Perl itself: GNU Public
       License version 1 or later and Perl Artistic License.

       The full	text of	the license can	be found in the	LICENSE	file included
       with this module	or at
       <> and

       Here is the summary of GPL:

       This program is	free software; you can redistribute  it	and/or modify
       it under	the  terms of the GNU General Public  License as published by
       the Free	 Software Foundation; either  version 1, or (at	 your option)
       any later version.

       This program  is	distributed in the  hope that it will  be useful, but
       WITHOUT	 ANY  WARRANTY;	  without  even	  the  implied	 warranty  of
       General Public License for more details.

       You  should have	received  a copy  of the  GNU General  Public License
       along with this program;	if not,	see <> or
       write to	the Free Software Foundation, Inc., <>.

SEE ALSO mailing list


perl v5.32.1			  2016-02-18	    DateTime::TimeZone::LMT(3)


Want to link to this manual page? Use this URL:

home | help