.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32 .\" .\" Standard preamble: .\" ======================================================================== .de Sh \" Subsection heading .br .if t .Sp .ne 5 .PP \fB\\$1\fR .PP .. .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' 'br\} .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .\" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .hy 0 .if n .na .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Weather::Com::DateTime 3pm" .TH Weather::Com::DateTime 3pm "2007-07-09" "perl v5.8.8" "User Contributed Perl Documentation" .SH "NAME" Weather::Com::DateTime \- date and time class .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 2 \& #!/usr/bin/perl \-w \& use Weather::Com::DateTime; .Ve .PP .Vb 3 \& my $gmt_offset = 1; # e.g. for Germany in winter \& my $datetime = Weather::Com::DateTime\->new($gmt_offset); \& $datetime\->set_lsup(\(aq02/25/05 11:21 PM Local Time\(aq); .Ve .PP .Vb 6 \& print "This is the date \(aq02/25/05 11:21 PM\(aq in Germany:\en"; \& print "Epoc: ", $datetime\->epoc(), "\en"; \& print "GMT (UTC): ". gmtime($datetime\->epoc()). "\en"; \& print "My local time: ". localtime($datetime\->epoc()). "\en"; \& print "And finally German time: ", $datetime\->time(), " o\(aqclock at ", \& $datetime\->date(), "\en\en"; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" \&\fIWeather::Com::DateTime\fR objects are used to encapsulate a date or time provided by the \s-1OO\s0 interface (e.g. localtime, sunrise, sunset, etc.). .PP This is done because there are many ways to use a date or time and to present it in your programs using \fIWeather::Com\fR. This class provides some predefined formats for date and time but also enables you to easily define your own ones. .PP These objects always represent the local time of a \fIWeather::Com::Location\fR object. That is, if you have a location object for New York City and your server running the weather script is located in Los Angeles, for example, this line .PP .Vb 1 \& print "Sunrise at: ", $location\->sunrise()\->time(), "\en"; .Ve .PP will print the time of sunrise (in 24h format) in \s-1EST\s0 and not corresponding to the timezone of Los Angeles! If you'd like to now what this is in \s-1GMT\s0 you could call .PP .Vb 1 \& print "Sunrise at: ". gmtime($location\->sunrise()\->epoc()). "\en"; .Ve .PP or if you want to know when the sun rises at the location in your servers local time than just call .PP .Vb 1 \& print "Sunrise at: ". localtime($location\->sunrise()\->epoc()). "\en"; .Ve .PP There are two ways to get your own date or time format: .IP "1." 4 You use the \f(CW\*(C`formatted()\*(C'\fR method and provide a format string to it. .IP "2." 4 If you'd like to define your own \f(CW\*(C`date()\*(C'\fR or \f(CW\*(C`time()\*(C'\fR method, simply change the corresponding methods. .Sp What you can change in which way without destroying the whole class, is described in section \fB\s-1INTERFACE\s0\fR. .SH "CONSTRUCTOR" .IX Header "CONSTRUCTOR" You usually would not construct an object of this class yourself. This is implicitely done when you call one of the \s-1OO\s0 interfaces date or time methods. .PP The constructor can take a \s-1GMT\s0 offset in positive or negative hours. .PP If one calls the constructor without any \s-1GMT\s0 offset, we assume you want a \s-1GMT\s0 object. .SH "METHODS" .IX Header "METHODS" .Sh "epoc(epoc seconds)" .IX Subsection "epoc(epoc seconds)" With this method you can set the date and time using epocs (\s-1GMT\s0) directly. .PP It returns the currently set epoc seconds (\s-1GMT\s0). .Sh "formatted(format)" .IX Subsection "formatted(format)" This method returns a date or time formatted in the way you ask for and corresponding to the local time of the parent object. .PP The \f(CW\*(C`format\*(C'\fR you provide to this method has to be a valid \fITime::Format\fR format. For details please refer to Time::Format. .Sh "set_date(date)" .IX Subsection "set_date(date)" With this method one can set the date of the object using an input format like \f(CW\*(C`Feb 13\*(C'\fR which is the 13th of february of the current year. .PP Using this method, the time is set to \fI00:00\fR. The year is the current one. .Sh "set_time(time)" .IX Subsection "set_time(time)" With this method one can set the time of the object using an input format like \f(CW\*(C`8:30 AM\*(C'\fR. .PP The date is set to the current date of the host the script is running on. .Sh "set_lsup(lsup)" .IX Subsection "set_lsup(lsup)" With this method one can set the date of the object using the \&\fIweather.com\fR's special last update format that is like \&\f(CW\*(C`2/12/05 4:50 PM Local Time\*(C'\fR. .Sh "\fIdate()\fP" .IX Subsection "date()" Returns the date in the format \f(CW\*(C`1. February 2005\*(C'\fR. .Sh "\fItime()\fP" .IX Subsection "time()" Returns the time in the format \f(CW\*(C`22:15\*(C'\fR. .Sh "\fItime_ampm()\fP" .IX Subsection "time_ampm()" Returns the time in the format \f(CW\*(C`10:15 PM\*(C'\fR. .Sh "\fIweekday()\fP" .IX Subsection "weekday()" Returns the day of week with like \f(CW\*(C`Wednesday\*(C'\fR. .Sh "\fIday()\fP" .IX Subsection "day()" Returns the day in month. .Sh "\fImonth()\fP" .IX Subsection "month()" Returns the name of the month. .Sh "\fImon()\fP" .IX Subsection "mon()" Returns the number of the month .Sh "\fIyear()\fP" .IX Subsection "year()" Returns the year (4 digits). .SH "AUTHOR" .IX Header "AUTHOR" Thomas Schnuecker, .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" Copyright (C) 2004\-2007 by Thomas Schnuecker .PP This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. .PP The data provided by \fIweather.com\fR and made accessible by this \s-1OO\s0 interface can be used for free under special terms. Please have a look at the application programming guide of \&\fIweather.com\fR ()!