datetime
Sponsored Links
Sponsored Links
Secleted [ 0 ] software to compare
Results 1 - 15 of about 80
DateTime 0.37
DateTime is a date and time object. more>>
DateTime is a date and time object.
SYNOPSIS
use DateTime;
$dt = DateTime->new( year => 1964,
month => 10,
day => 16,
hour => 16,
minute => 12,
second => 47,
nanosecond => 500000000,
time_zone => Asia/Taipei,
);
$dt = DateTime->from_epoch( epoch => $epoch );
$dt = DateTime->now; # same as ( epoch => time() )
$year = $dt->year;
$month = $dt->month; # 1-12 - also mon
$day = $dt->day; # 1-31 - also day_of_month, mday
$dow = $dt->day_of_week; # 1-7 (Monday is 1) - also dow, wday
$hour = $dt->hour; # 0-23
$minute = $dt->minute; # 0-59 - also min
$second = $dt->second; # 0-61 (leap seconds!) - also sec
$doy = $dt->day_of_year; # 1-366 (leap years) - also doy
$doq = $dt->day_of_quarter; # 1.. - also doq
$qtr = $dt->quarter; # 1-4
# all of the start-at-1 methods above have correponding start-at-0
# methods, such as $dt->day_of_month_0, $dt->month_0 and so on
$ymd = $dt->ymd; # 2002-12-06
$ymd = $dt->ymd(/); # 2002/12/06 - also date
$mdy = $dt->mdy; # 12-06-2002
$mdy = $dt->mdy(/); # 12/06/2002
$dmy = $dt->dmy; # 06-12-2002
$dmy = $dt->dmy(/); # 06/12/2002
$hms = $dt->hms; # 14:02:29
$hms = $dt->hms(!); # 14!02!29 - also time
$is_leap = $dt->is_leap_year;
# these are localizable, see Locales section
$month_name = $dt->month_name; # January, February, ...
$month_abbr = $dt->month_abbr; # Jan, Feb, ...
$day_name = $dt->day_name; # Monday, Tuesday, ...
$day_abbr = $dt->day_abbr; # Mon, Tue, ...
$epoch_time = $dt->epoch;
# may return undef if the datetime is outside the range that is
# representable by your OSs epoch system.
$dt2 = $dt + $duration_object;
$dt3 = $dt - $duration_object;
$duration_object = $dt - $dt2;
$dt->set( year => 1882 );
$dt->set_time_zone( America/Chicago );
$dt->set_formatter( $formatter );
DateTime is a class for the representation of date/time combinations, and is part of the Perl DateTime project. For details on this project please see http://datetime.perl.org/. The DateTime site has a FAQ which may help answer many "how do I do X?" questions. The FAQ is at http://datetime.perl.org/faq.html.
It represents the Gregorian calendar, extended backwards in time before its creation (in 1582). This is sometimes known as the "proleptic Gregorian calendar". In this calendar, the first day of the calendar (the epoch), is the first day of year 1, which corresponds to the date which was (incorrectly) believed to be the birth of Jesus Christ.
The calendar represented does have a year 0, and in that way differs from how dates are often written using "BCE/CE" or "BC/AD".
For infinite datetimes, please see the DateTime::Infinite module.
<<lessSYNOPSIS
use DateTime;
$dt = DateTime->new( year => 1964,
month => 10,
day => 16,
hour => 16,
minute => 12,
second => 47,
nanosecond => 500000000,
time_zone => Asia/Taipei,
);
$dt = DateTime->from_epoch( epoch => $epoch );
$dt = DateTime->now; # same as ( epoch => time() )
$year = $dt->year;
$month = $dt->month; # 1-12 - also mon
$day = $dt->day; # 1-31 - also day_of_month, mday
$dow = $dt->day_of_week; # 1-7 (Monday is 1) - also dow, wday
$hour = $dt->hour; # 0-23
$minute = $dt->minute; # 0-59 - also min
$second = $dt->second; # 0-61 (leap seconds!) - also sec
$doy = $dt->day_of_year; # 1-366 (leap years) - also doy
$doq = $dt->day_of_quarter; # 1.. - also doq
$qtr = $dt->quarter; # 1-4
# all of the start-at-1 methods above have correponding start-at-0
# methods, such as $dt->day_of_month_0, $dt->month_0 and so on
$ymd = $dt->ymd; # 2002-12-06
$ymd = $dt->ymd(/); # 2002/12/06 - also date
$mdy = $dt->mdy; # 12-06-2002
$mdy = $dt->mdy(/); # 12/06/2002
$dmy = $dt->dmy; # 06-12-2002
$dmy = $dt->dmy(/); # 06/12/2002
$hms = $dt->hms; # 14:02:29
$hms = $dt->hms(!); # 14!02!29 - also time
$is_leap = $dt->is_leap_year;
# these are localizable, see Locales section
$month_name = $dt->month_name; # January, February, ...
$month_abbr = $dt->month_abbr; # Jan, Feb, ...
$day_name = $dt->day_name; # Monday, Tuesday, ...
$day_abbr = $dt->day_abbr; # Mon, Tue, ...
$epoch_time = $dt->epoch;
# may return undef if the datetime is outside the range that is
# representable by your OSs epoch system.
$dt2 = $dt + $duration_object;
$dt3 = $dt - $duration_object;
$duration_object = $dt - $dt2;
$dt->set( year => 1882 );
$dt->set_time_zone( America/Chicago );
$dt->set_formatter( $formatter );
DateTime is a class for the representation of date/time combinations, and is part of the Perl DateTime project. For details on this project please see http://datetime.perl.org/. The DateTime site has a FAQ which may help answer many "how do I do X?" questions. The FAQ is at http://datetime.perl.org/faq.html.
It represents the Gregorian calendar, extended backwards in time before its creation (in 1582). This is sometimes known as the "proleptic Gregorian calendar". In this calendar, the first day of the calendar (the epoch), is the first day of year 1, which corresponds to the date which was (incorrectly) believed to be the birth of Jesus Christ.
The calendar represented does have a year 0, and in that way differs from how dates are often written using "BCE/CE" or "BC/AD".
For infinite datetimes, please see the DateTime::Infinite module.
Download (0.093MB)
Added: 2007-05-16 License: GPL (GNU General Public License) Price:
893 downloads
App::datetime 0.964
App::datetime is a date and time considerations. more>>
App::datetime is a date and time considerations.
Most Enterprise development includes processing of dates and times. There are many date and time modules on CPAN, and choosing the right one can be confusing. There are no special perl data types for dates and times, so some direction is needed.
The short answer is that we recommend the following for most common date and time operations.
Class::Date
Class::Date::Rel
However, other modules are appropriate in certain circumstances. So for the longer answer, read on.
PERL 5 LANGUAGE SUPPORT
The native Perl 5 datetime type is an integer. It is not different from other integers in any way other than how it is used. It represents the number of non-leap seconds since January 1, 1970 UTC (the "Epoch" at GMT). The following internal Perl function gets the current time.
$current_time = time;
$current_time = time();
Other Perl functions that return this "datetime" integer are
($dev, $ino, $mode, $nlink, $uid, $gid, $redev, $size,
$atime, $mtime, $ctime, $blksize, $blocks) = stat($filename);
($dev, $ino, $mode, $nlink, $uid, $gid, $redev, $size,
$atime, $mtime, $ctime, $blksize, $blocks) = lstat($filename);
where $atime, $mtime, and $ctime are the same kind of integers, representing the access time, modification time, and change time of a file.
These $time values may be converted to human-readable form using the following internal perl functions. (See the "perlfunc" man page for more information.)
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = gmtime($time);
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($time);
Furthermore, the current time zone needs to be accessed through the environment variable, "TZ".
$timezone = $ENV{TZ};
This leaves the Perl developer with lots of work to do in order to process dates.
Formatting dates for output
Parsing dates on input
Comparing dates
Date math (addition, subtraction)
Other calendar-specific functions (i.e. holidays, days of week, etc)
Numerous modules have been posted to CPAN allowing the Perl developer to accomplish these tasks. However, they have pros and cons related to the following features.
Internationalization
Speed
Portability
Ranges of Dates Supported
Compliance with Perl Styleguide (function naming)
<<lessMost Enterprise development includes processing of dates and times. There are many date and time modules on CPAN, and choosing the right one can be confusing. There are no special perl data types for dates and times, so some direction is needed.
The short answer is that we recommend the following for most common date and time operations.
Class::Date
Class::Date::Rel
However, other modules are appropriate in certain circumstances. So for the longer answer, read on.
PERL 5 LANGUAGE SUPPORT
The native Perl 5 datetime type is an integer. It is not different from other integers in any way other than how it is used. It represents the number of non-leap seconds since January 1, 1970 UTC (the "Epoch" at GMT). The following internal Perl function gets the current time.
$current_time = time;
$current_time = time();
Other Perl functions that return this "datetime" integer are
($dev, $ino, $mode, $nlink, $uid, $gid, $redev, $size,
$atime, $mtime, $ctime, $blksize, $blocks) = stat($filename);
($dev, $ino, $mode, $nlink, $uid, $gid, $redev, $size,
$atime, $mtime, $ctime, $blksize, $blocks) = lstat($filename);
where $atime, $mtime, and $ctime are the same kind of integers, representing the access time, modification time, and change time of a file.
These $time values may be converted to human-readable form using the following internal perl functions. (See the "perlfunc" man page for more information.)
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = gmtime($time);
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($time);
Furthermore, the current time zone needs to be accessed through the environment variable, "TZ".
$timezone = $ENV{TZ};
This leaves the Perl developer with lots of work to do in order to process dates.
Formatting dates for output
Parsing dates on input
Comparing dates
Date math (addition, subtraction)
Other calendar-specific functions (i.e. holidays, days of week, etc)
Numerous modules have been posted to CPAN allowing the Perl developer to accomplish these tasks. However, they have pros and cons related to the following features.
Internationalization
Speed
Portability
Ranges of Dates Supported
Compliance with Perl Styleguide (function naming)
Download (0.12MB)
Added: 2006-10-17 License: Perl Artistic License Price:
1102 downloads
Rose::DateTime 0.532
Rose::DateTime is a Perl module with DateTime helper functions and objects. more>>
Rose::DateTime is a Perl module with DateTime helper functions and objects.
SYNOPSIS
use Rose::DateTime::Util qw(:all);
$now = parse_date(now);
$then = parse_date(12/25/2001 6pm);
$date_text = format_date($then, "%D at %T %p");
...
use Rose::DateTime::Parser;
$parser = Rose::DateTime::Parser->new(time_zone => UTC);
$date = $parser->parse_date(12/25/1999);
The Rose::DateTime::* modules provide a few convenience functions and objects for use with DateTime dates.
Rose::DateTime::Util contains a simple date parser and a slightly customized date formatter.
Rose::DateTime::Parser encapsulates a date parser with an associated default time zone.
This module (Rose::DateTime) exists mostly to provide a version number for CPAN. See the individual modules for some actual documentation.
<<lessSYNOPSIS
use Rose::DateTime::Util qw(:all);
$now = parse_date(now);
$then = parse_date(12/25/2001 6pm);
$date_text = format_date($then, "%D at %T %p");
...
use Rose::DateTime::Parser;
$parser = Rose::DateTime::Parser->new(time_zone => UTC);
$date = $parser->parse_date(12/25/1999);
The Rose::DateTime::* modules provide a few convenience functions and objects for use with DateTime dates.
Rose::DateTime::Util contains a simple date parser and a slightly customized date formatter.
Rose::DateTime::Parser encapsulates a date parser with an associated default time zone.
This module (Rose::DateTime) exists mostly to provide a version number for CPAN. See the individual modules for some actual documentation.
Download (0.011MB)
Added: 2007-05-21 License: GPL (GNU General Public License) Price:
886 downloads
DateTime::Locale 0.34
DateTime::Locale - Localization support for DateTime.pm more>>
DateTime::Locale is a Perl module with localization support for DateTime.pm.
SYNOPSIS
use DateTime::Locale;
my $loc = DateTime::Locale->load(en_GB);
print $loc->native_locale_name, "n",
$loc->long_datetime_format, "n";
# but mostly just things like ...
my $dt = DateTime->now( locale => fr );
print "Aujourdhui le mois est " . $dt->month_name, "n":
DateTime::Locale is primarily a factory for the various locale subclasses. It also provides some functions for getting information on available locales.
If you want to know what methods are available for locale objects, then please read the DateTime::Locale::Base documentation.
<<lessSYNOPSIS
use DateTime::Locale;
my $loc = DateTime::Locale->load(en_GB);
print $loc->native_locale_name, "n",
$loc->long_datetime_format, "n";
# but mostly just things like ...
my $dt = DateTime->now( locale => fr );
print "Aujourdhui le mois est " . $dt->month_name, "n":
DateTime::Locale is primarily a factory for the various locale subclasses. It also provides some functions for getting information on available locales.
If you want to know what methods are available for locale objects, then please read the DateTime::Locale::Base documentation.
Download (0.10MB)
Added: 2007-06-19 License: Perl Artistic License Price:
863 downloads
DateTime::Precise 1.05
DateTime::Precise can perform common time and date operations with additional GPS operations. more>>
DateTime::Precise can perform common time and date operations with additional GPS operations.
SYNOPSIS
use DateTime::Precise;
use DateTime::Precise qw(:TimeVars);
# Constructors and ways to set time.
$t1 = DateTime::Precise->new;
$t2 = DateTime::Precise->new(1998. 4. 3 12:13:44.054);
$t3 = DateTime::Precise->new(time() - 100.23456);
$t4 = DateTime::Precise->new(1998.04.24);
$t1->set_localtime_from_epoch_time;
$t1->set_gmtime_from_epoch_time(time + 120.987);
$t1->set_from_datetime(1998.03.23 16:58:14.65);
$t1->set_time(YDHMS, 1998, 177, 9, 15, 26.5);
# This is the same as $d3->set_from_datetime(...)
$t3->dscanf("%^Y.%M.%D %h:%m:%s", "1998.03.25 20:25:23");
if ($msg = $d1->dscanf("%~M", $input)) {
print "error: $msgn";
print "Must enter a three-letter month abbrev.n";
}
# Get different parts of the time.
$year = $t3->year;
$month = $t3->month;
$day = $t3->day;
$hours = $t3->hours;
$minutes = $t3->minutes;
$seconds = $t3->seconds;
($year, $day_of_year) = $t3->get_time(Yj);
# Print times and dates.
print $t2->asctime;
print $t2->strftime(%T %C%n);
print $t2->dprintf("%^Y.%M.%D %h:%m:%s"); # datetime
print $t2->dprintf("%~w %~M %-D %h:%m:%s CST %^Y"); # ctime
# Copy times.
my $t4 = $t2->copy;
# Set one time object to the same time as another: set $t3 equal to $t2.
$t3->clone($t2);
# Find the difference between two times.
$secs_from_midnight = $t4 - $t1;
$secs_from_midnight = $t4->diff($t1);
# Add seconds, days, months, etc to time.
$t1 = $t4 + 3600; # $t1 is now an hour after midnight
$t1->inc_month(2); # add two months to $t1
$t1->floor_month; # set $t1 to the first of the month
$t1 -= 0.25; # subtract 1/4 of a second from $t1
# Can compare and sort DateTime::Precise.
print "Its late!!!" if ($t1 > $t4);
@sorted = sort @birthdays; # normal comparisons work fine
# Get the GPS weeks, seconds and day.
$gps_week = $t1->gps_week;
$gps_seconds = $t1->gps_seconds;
$gps_day = $t1->gps_day;
($gps_week, $gps_seconds, $gps_day) = $t1->gps_week_seconds_day;
<<lessSYNOPSIS
use DateTime::Precise;
use DateTime::Precise qw(:TimeVars);
# Constructors and ways to set time.
$t1 = DateTime::Precise->new;
$t2 = DateTime::Precise->new(1998. 4. 3 12:13:44.054);
$t3 = DateTime::Precise->new(time() - 100.23456);
$t4 = DateTime::Precise->new(1998.04.24);
$t1->set_localtime_from_epoch_time;
$t1->set_gmtime_from_epoch_time(time + 120.987);
$t1->set_from_datetime(1998.03.23 16:58:14.65);
$t1->set_time(YDHMS, 1998, 177, 9, 15, 26.5);
# This is the same as $d3->set_from_datetime(...)
$t3->dscanf("%^Y.%M.%D %h:%m:%s", "1998.03.25 20:25:23");
if ($msg = $d1->dscanf("%~M", $input)) {
print "error: $msgn";
print "Must enter a three-letter month abbrev.n";
}
# Get different parts of the time.
$year = $t3->year;
$month = $t3->month;
$day = $t3->day;
$hours = $t3->hours;
$minutes = $t3->minutes;
$seconds = $t3->seconds;
($year, $day_of_year) = $t3->get_time(Yj);
# Print times and dates.
print $t2->asctime;
print $t2->strftime(%T %C%n);
print $t2->dprintf("%^Y.%M.%D %h:%m:%s"); # datetime
print $t2->dprintf("%~w %~M %-D %h:%m:%s CST %^Y"); # ctime
# Copy times.
my $t4 = $t2->copy;
# Set one time object to the same time as another: set $t3 equal to $t2.
$t3->clone($t2);
# Find the difference between two times.
$secs_from_midnight = $t4 - $t1;
$secs_from_midnight = $t4->diff($t1);
# Add seconds, days, months, etc to time.
$t1 = $t4 + 3600; # $t1 is now an hour after midnight
$t1->inc_month(2); # add two months to $t1
$t1->floor_month; # set $t1 to the first of the month
$t1 -= 0.25; # subtract 1/4 of a second from $t1
# Can compare and sort DateTime::Precise.
print "Its late!!!" if ($t1 > $t4);
@sorted = sort @birthdays; # normal comparisons work fine
# Get the GPS weeks, seconds and day.
$gps_week = $t1->gps_week;
$gps_seconds = $t1->gps_seconds;
$gps_day = $t1->gps_day;
($gps_week, $gps_seconds, $gps_day) = $t1->gps_week_seconds_day;
Download (0.034MB)
Added: 2007-08-09 License: Perl Artistic License Price:
807 downloads
Xfce 4 Datetime Plugin 0.5.0
Xfce 4 Datetime Plugin shows the date and time in the panel, and a calendar appears when you left-click on it. more>> <<less
Download (0.36MB)
Added: 2007-03-06 License: GPL (GNU General Public License) Price:
962 downloads
Lingua::ZH::DateTime 0.01
Lingua::ZH::DateTime is a Perl module to convert time to chinese format. more>>
Lingua::ZH::DateTime is a Perl module to convert time to chinese format.
SYNOPSIS
This module can convert asctime to chinese format in your locale. you can select china singapore hongkong taiwan locale and gb2312/big5 charset. asctime is ASC C standard format will from localtime like this:
$asctime = localtime();
<<lessSYNOPSIS
This module can convert asctime to chinese format in your locale. you can select china singapore hongkong taiwan locale and gb2312/big5 charset. asctime is ASC C standard format will from localtime like this:
$asctime = localtime();
Download (0.003MB)
Added: 2006-08-09 License: Perl Artistic License Price:
1173 downloads
DateTime::Format::Pg 0.15
DateTime::Format::Pg is a Perl module to parse and format PostgreSQL dates and times. more>>
DateTime::Format::Pg is a Perl module to parse and format PostgreSQL dates and times.
SYNOPSIS
use DateTime::Format::Pg;
my $dt = DateTime::Format::Pg->parse_datetime( 2003-01-16 23:12:01 );
# 2003-01-16T23:12:01+0200
DateTime::Format::Pg->format_datetime($dt);
This module understands the formats used by PostgreSQL for its DATE, TIME, TIMESTAMP, and INTERVAL data types. It can be used to parse these formats in order to create DateTime or DateTime::Duration objects, and it can take a DateTime or DateTime::Duration object and produce a string representing it in a format accepted by PostgreSQL.
CONSTRUCTORS
The following methods can be used to create DateTime::Format::Pg objects.
new( name => value, ... )
Creates a new DateTime::Format::Pg instance. This is generally not required for simple operations. If you wish to use a different parsing style from the default then it is more comfortable to create an object.
my $parser = DateTime::Format::Pg->new()
my $copy = $parser->new( european => 1 );
This method accepts the following options:
european
If european is set to non-zero, dates are assumed to be in european dd/mm/yyyy format. The default is to assume US mm/dd/yyyy format (because this is the default for PostgreSQL).
This option only has an effect if PostgreSQL is set to output dates in the PostgreSQL (DATE only) and SQL (DATE and TIMESTAMP) styles.
Note that you dont have to set this option if the PostgreSQL server has been set to use the ISO format, which is the default.
server_tz
This option can be set to a DateTime::TimeZone object or a string that contains a time zone name.
This value must be set to the same value as the PostgreSQL servers time zone in order to parse TIMESTAMP WITH TIMEZONE values in the PostgreSQL, SQL, and German formats correctly.
Note that you dont have to set this option if the PostgreSQL server has been set to use the ISO format, which is the default.
clone()
This method is provided for those who prefer to explicitly clone via a method called clone().
my $clone = $original->clone();
If called as a class method it will die.
<<lessSYNOPSIS
use DateTime::Format::Pg;
my $dt = DateTime::Format::Pg->parse_datetime( 2003-01-16 23:12:01 );
# 2003-01-16T23:12:01+0200
DateTime::Format::Pg->format_datetime($dt);
This module understands the formats used by PostgreSQL for its DATE, TIME, TIMESTAMP, and INTERVAL data types. It can be used to parse these formats in order to create DateTime or DateTime::Duration objects, and it can take a DateTime or DateTime::Duration object and produce a string representing it in a format accepted by PostgreSQL.
CONSTRUCTORS
The following methods can be used to create DateTime::Format::Pg objects.
new( name => value, ... )
Creates a new DateTime::Format::Pg instance. This is generally not required for simple operations. If you wish to use a different parsing style from the default then it is more comfortable to create an object.
my $parser = DateTime::Format::Pg->new()
my $copy = $parser->new( european => 1 );
This method accepts the following options:
european
If european is set to non-zero, dates are assumed to be in european dd/mm/yyyy format. The default is to assume US mm/dd/yyyy format (because this is the default for PostgreSQL).
This option only has an effect if PostgreSQL is set to output dates in the PostgreSQL (DATE only) and SQL (DATE and TIMESTAMP) styles.
Note that you dont have to set this option if the PostgreSQL server has been set to use the ISO format, which is the default.
server_tz
This option can be set to a DateTime::TimeZone object or a string that contains a time zone name.
This value must be set to the same value as the PostgreSQL servers time zone in order to parse TIMESTAMP WITH TIMEZONE values in the PostgreSQL, SQL, and German formats correctly.
Note that you dont have to set this option if the PostgreSQL server has been set to use the ISO format, which is the default.
clone()
This method is provided for those who prefer to explicitly clone via a method called clone().
my $clone = $original->clone();
If called as a class method it will die.
Download (0.019MB)
Added: 2007-05-17 License: Perl Artistic License Price:
890 downloads
DateTime::Cron::Simple 0.2
DateTime::Cron::Simple is a Perl module that can parse a cron entry and check against current time. more>>
DateTime::Cron::Simple is a Perl module that can parse a cron entry and check against current time.
SYNOPSIS
use DateTime::Cron::Simple;
$c = DateTime::Cron::Simple->new($cron);
$boolean = $c->validate_time;
$c->new_cron($cron);
This module is a quick and dirty way to determine if a cron time format is valid for the current date and time.
A cron entry follows the cron format from crontab(5).
The validate_time function uses the current date and time for comparison, but will also accept a valid DateTime object as a parameter.
EXAMPLE
use DateTime::Cron::Simple;
$c = DateTime::Cron::Simple->new(0-59/2 10,12 * * 5);
if($c->validate_time) { ... }
$c->new_cron(* * 1 * 0);
if($c->validate_time) { ... }
<<lessSYNOPSIS
use DateTime::Cron::Simple;
$c = DateTime::Cron::Simple->new($cron);
$boolean = $c->validate_time;
$c->new_cron($cron);
This module is a quick and dirty way to determine if a cron time format is valid for the current date and time.
A cron entry follows the cron format from crontab(5).
The validate_time function uses the current date and time for comparison, but will also accept a valid DateTime object as a parameter.
EXAMPLE
use DateTime::Cron::Simple;
$c = DateTime::Cron::Simple->new(0-59/2 10,12 * * 5);
if($c->validate_time) { ... }
$c->new_cron(* * 1 * 0);
if($c->validate_time) { ... }
Download (0.003MB)
Added: 2006-12-20 License: Perl Artistic License Price:
1041 downloads
DateTime::Event::Cron 0.07
DateTime::Event::Cron is a DateTime extension for generating recurrence sets from crontab lines and files. more>>
DateTime::Event::Cron is a DateTime extension for generating recurrence sets from crontab lines and files.
SYNOPSIS
use DateTime::Event::Cron;
# DateTime::Set construction from crontab line
$crontab = */3 15 1-10 3,4,5 */2;
$set = DateTime::Event::Cron->from_cron($crontab);
$iter = $set->iterator(after => DateTime->now);
while (1) {
my $next = $iter->next;
my $now = DateTime->now;
sleep(($next->subtract_datetime_absolute($now))->seconds);
# do stuff...
}
# List of DateTime::Set objects from crontab file
@sets = DateTime::Event::Cron->from_crontab(file => /etc/crontab);
$now = DateTime->now;
print "Now: ", $now->datetime, "n";
foreach (@sets) {
my $next = $_->next($now);
print $next->datetime, "n";
}
# DateTime::Set parameters
$crontab = * * * * *;
$now = DateTime->now;
%set_parms = ( after => $now );
$set = DateTime::Event::Cron->from_cron(cron => $crontab, %set_parms);
$dt = $set->next;
print "Now: ", $now->datetime, " and next: ", $dt->datetime, "n";
# Spans for DateTime::Set
$crontab = * * * * *;
$now = DateTime->now;
$now2 = $now->clone;
$span = DateTime::Span->from_datetimes(
start => $now->add(minutes => 1),
end => $now2->add(hours => 1),
);
%parms = (cron => $crontab, span => $span);
$set = DateTime::Event::Cron->from_cron(%parms);
# ...do things with the DateTime::Set
# Every RTFCT relative to 12am Jan 1st this year
$crontab = 7-10 6,12-15 10-28/2 */3 3,4,5;
$date = DateTime->now->truncate(to => year);
$set = DateTime::Event::Cron->from_cron(cron => $crontab, after => $date);
# Rather than generating DateTime::Set objects, next/prev
# calculations can be made directly:
# Every day at 10am, 2pm, and 6pm. Reference date
# defaults to DateTime->now.
$crontab = 10,14,18 * * * *;
$dtc = DateTime::Event::Cron->new_from_cron(cron => $crontab);
$next_datetime = $dtc->next;
$last_datetime = $dtc->previous;
...
# List of DateTime::Event::Cron objects from
# crontab file
@dtc = DateTime::Event::Cron->new_from_crontab(file => /etc/crontab);
# Full cron lines with user, such as from /etc/crontab
# or files in /etc/cron.d, are supported and auto-detected:
$crontab = * * * * * gump /bin/date;
$dtc = DateTime::Event::Cron->new(cron => $crontab);
# Auto-detection of users is disabled if you explicitly
# enable/disable via the user_mode parameter:
$dtc = DateTime::Event::Cron->new(cron => $crontab, user_mode => 1);
my $user = $dtc->user;
my $command = $dtc->command;
# Unparsed original cron entry
my $original = $dtc->original;
<<lessSYNOPSIS
use DateTime::Event::Cron;
# DateTime::Set construction from crontab line
$crontab = */3 15 1-10 3,4,5 */2;
$set = DateTime::Event::Cron->from_cron($crontab);
$iter = $set->iterator(after => DateTime->now);
while (1) {
my $next = $iter->next;
my $now = DateTime->now;
sleep(($next->subtract_datetime_absolute($now))->seconds);
# do stuff...
}
# List of DateTime::Set objects from crontab file
@sets = DateTime::Event::Cron->from_crontab(file => /etc/crontab);
$now = DateTime->now;
print "Now: ", $now->datetime, "n";
foreach (@sets) {
my $next = $_->next($now);
print $next->datetime, "n";
}
# DateTime::Set parameters
$crontab = * * * * *;
$now = DateTime->now;
%set_parms = ( after => $now );
$set = DateTime::Event::Cron->from_cron(cron => $crontab, %set_parms);
$dt = $set->next;
print "Now: ", $now->datetime, " and next: ", $dt->datetime, "n";
# Spans for DateTime::Set
$crontab = * * * * *;
$now = DateTime->now;
$now2 = $now->clone;
$span = DateTime::Span->from_datetimes(
start => $now->add(minutes => 1),
end => $now2->add(hours => 1),
);
%parms = (cron => $crontab, span => $span);
$set = DateTime::Event::Cron->from_cron(%parms);
# ...do things with the DateTime::Set
# Every RTFCT relative to 12am Jan 1st this year
$crontab = 7-10 6,12-15 10-28/2 */3 3,4,5;
$date = DateTime->now->truncate(to => year);
$set = DateTime::Event::Cron->from_cron(cron => $crontab, after => $date);
# Rather than generating DateTime::Set objects, next/prev
# calculations can be made directly:
# Every day at 10am, 2pm, and 6pm. Reference date
# defaults to DateTime->now.
$crontab = 10,14,18 * * * *;
$dtc = DateTime::Event::Cron->new_from_cron(cron => $crontab);
$next_datetime = $dtc->next;
$last_datetime = $dtc->previous;
...
# List of DateTime::Event::Cron objects from
# crontab file
@dtc = DateTime::Event::Cron->new_from_crontab(file => /etc/crontab);
# Full cron lines with user, such as from /etc/crontab
# or files in /etc/cron.d, are supported and auto-detected:
$crontab = * * * * * gump /bin/date;
$dtc = DateTime::Event::Cron->new(cron => $crontab);
# Auto-detection of users is disabled if you explicitly
# enable/disable via the user_mode parameter:
$dtc = DateTime::Event::Cron->new(cron => $crontab, user_mode => 1);
my $user = $dtc->user;
my $command = $dtc->command;
# Unparsed original cron entry
my $original = $dtc->original;
Download (0.010MB)
Added: 2007-05-16 License: Perl Artistic License Price:
891 downloads
Rose::DateTime::Util 0.532
Rose::DateTime::Util Perl module contains some simple DateTime wrapper functions. more>>
Rose::DateTime::Util Perl module contains some simple DateTime wrapper functions.
SYNOPSIS
use Rose::DateTime::Util qw(:all);
$now = parse_date(now);
$then = parse_date(12/25/2001 11pm);
print $now->day_of_week; # e.g., "Monday"
# "December 25th 2001 at 11:00:00 PM"
$date_text = format_date($then, "%B %E %Y at %t");
EXPORTS
Rose::DateTime::Util does not export any function names by default.
The all tag:
use Rose::DateTime::Util qw(:all);
will cause the following function names to be imported:
format_date()
parse_date()
parse_epoch()
parse_european_date()
CLASS METHODS
error
Returns a message describing the last error that occurred.
european_dates [BOOL]
Get or set a boolean flag that determines how "xx/xx/xxxx" dates are parsed by the parse_date function. If set to a false-but-defined value, then such dates are parsed as "mm/dd/yyyy". If set to true, then theyre parsed as "dd/mm/yyyy". If set to undef, then the attribute resets to its initial value, which is determined as described below.
The initial value of this attribute is chosen based on the current locale as stored in DateTimes DefaultLocale setting. This initial value is looked up only once. Any subsequent changes to DateTimes DefaultLocale setting will be ignored until/unless this attribute is reset to undef.
time_zone [TZ]
Get or set the default time zone. This value is passed to DateTime->new(...) as the value of the time_zone parameter when parse_date() creates the DateTime object that it returns. The default value is "floating".
<<lessSYNOPSIS
use Rose::DateTime::Util qw(:all);
$now = parse_date(now);
$then = parse_date(12/25/2001 11pm);
print $now->day_of_week; # e.g., "Monday"
# "December 25th 2001 at 11:00:00 PM"
$date_text = format_date($then, "%B %E %Y at %t");
EXPORTS
Rose::DateTime::Util does not export any function names by default.
The all tag:
use Rose::DateTime::Util qw(:all);
will cause the following function names to be imported:
format_date()
parse_date()
parse_epoch()
parse_european_date()
CLASS METHODS
error
Returns a message describing the last error that occurred.
european_dates [BOOL]
Get or set a boolean flag that determines how "xx/xx/xxxx" dates are parsed by the parse_date function. If set to a false-but-defined value, then such dates are parsed as "mm/dd/yyyy". If set to true, then theyre parsed as "dd/mm/yyyy". If set to undef, then the attribute resets to its initial value, which is determined as described below.
The initial value of this attribute is chosen based on the current locale as stored in DateTimes DefaultLocale setting. This initial value is looked up only once. Any subsequent changes to DateTimes DefaultLocale setting will be ignored until/unless this attribute is reset to undef.
time_zone [TZ]
Get or set the default time zone. This value is passed to DateTime->new(...) as the value of the time_zone parameter when parse_date() creates the DateTime object that it returns. The default value is "floating".
Download (0.012MB)
Added: 2007-07-24 License: Perl Artistic License Price:
822 downloads
Data::Faker::DateTime 0.07
Data::Faker::DateTime is a Data::Faker plugin. more>>
Data::Faker::DateTime is a Data::Faker plugin.
DATA PROVIDERS
unixtime
Return a unix time (seconds since the epoch) for a random time between the epoch and now.
date
Return a random date as a string, using a random date format (see date_format).
time
Return a random time as a string, using a random time format (see time_format).
rfc822
Return an RFC 822 formatted random date. This method may not work on systems using a non-GNU strftime implementation (kindly let me know if that is the case.)
ampm
Returns am or pm randomly (in the current locale) using one of the formats specified in ampm_format.
time_format
Return a random time format.
date_format
Return a random date format.
ampm_format
Return a random am/pm format.
datetime_format
Return a random date and time format.
month
Return a random month name, unabbreviated, in the current locale.
month_abbr
Return a random month name, abbreviated, in the current locale.
weekday
Return a random weekday name, unabbreviated, in the current locale.
weekday_abbr
Return a random weekday name, abbreviated, in the current locale.
sqldate
Return a random date in the ISO8601 format commonly used by SQL servers (YYYY-MM-DD).
datetime_locale
Return a datetime string in the preferred date representation for the current locale, for a random date.
date_locale
Return a date string in the preferred date representation for the current locale, for a random date.
time_locale
Return a time string in the preferred date representation for the current locale, for a random date.
century
Return a random century number.
dayofmonth
Return a random day of the month.
<<lessDATA PROVIDERS
unixtime
Return a unix time (seconds since the epoch) for a random time between the epoch and now.
date
Return a random date as a string, using a random date format (see date_format).
time
Return a random time as a string, using a random time format (see time_format).
rfc822
Return an RFC 822 formatted random date. This method may not work on systems using a non-GNU strftime implementation (kindly let me know if that is the case.)
ampm
Returns am or pm randomly (in the current locale) using one of the formats specified in ampm_format.
time_format
Return a random time format.
date_format
Return a random date format.
ampm_format
Return a random am/pm format.
datetime_format
Return a random date and time format.
month
Return a random month name, unabbreviated, in the current locale.
month_abbr
Return a random month name, abbreviated, in the current locale.
weekday
Return a random weekday name, unabbreviated, in the current locale.
weekday_abbr
Return a random weekday name, abbreviated, in the current locale.
sqldate
Return a random date in the ISO8601 format commonly used by SQL servers (YYYY-MM-DD).
datetime_locale
Return a datetime string in the preferred date representation for the current locale, for a random date.
date_locale
Return a date string in the preferred date representation for the current locale, for a random date.
time_locale
Return a time string in the preferred date representation for the current locale, for a random date.
century
Return a random century number.
dayofmonth
Return a random day of the month.
Download (0.020MB)
Added: 2006-10-25 License: Perl Artistic License Price:
1096 downloads
DateTime::Format::Epoch 0.10
DateTime::Format::Epoch is a Perl module that can convert DateTimes to/from epoch seconds. more>>
DateTime::Format::Epoch is a Perl module that can convert DateTimes to/from epoch seconds.
SYNOPSIS
use DateTime::Format::Epoch;
my $dt = DateTime->new( year => 1970, month => 1, day => 1 );
my $formatter = DateTime::Format::Epoch->new(
epoch => $dt,
unit => seconds,
type => int, # or float, bigint
skip_leap_secondss => 1,
start_at => 0,
local_epoch => undef,
);
my $dt2 = $formatter->parse_datetime( 1051488000 );
# 2003-04-28T00:00:00
$formatter->format_datetime($dt2);
# 1051488000
This module can convert a DateTime object (or any object that can be converted to a DateTime object) to the number of seconds since a given epoch. It can also do the reverse.
<<lessSYNOPSIS
use DateTime::Format::Epoch;
my $dt = DateTime->new( year => 1970, month => 1, day => 1 );
my $formatter = DateTime::Format::Epoch->new(
epoch => $dt,
unit => seconds,
type => int, # or float, bigint
skip_leap_secondss => 1,
start_at => 0,
local_epoch => undef,
);
my $dt2 = $formatter->parse_datetime( 1051488000 );
# 2003-04-28T00:00:00
$formatter->format_datetime($dt2);
# 1051488000
This module can convert a DateTime object (or any object that can be converted to a DateTime object) to the number of seconds since a given epoch. It can also do the reverse.
Download (0.017MB)
Added: 2006-08-15 License: Perl Artistic License Price:
1168 downloads
DateTime::Format::Roman 0.03
DateTime::Format::Roman is a Perl module with roman day numbering for DateTime objects. more>>
DateTime::Format::Roman is a Perl module with roman day numbering for DateTime objects.
SYNOPSIS
use DateTime::Format::Roman;
my $formatter = DateTime::Format::Roman->new(
pattern => %d %f %b %y );
my $dt = DateTime->new( year => 2003, month => 5, day => 28 );
$formatter->format_datetime($dt);
# 5 Kal Jun 2003
This module formats dates in the Roman style.
The Romans expressed their dates in relation to three fixed dates per month. For example: the Ides of March was the 15th of that month; 14 March was called "2 Ides", 13 March was called "3 Ides", etcetera. The days in the second half of the month were named after the first day of the next month, the "Kalends"; e.g. 16 March was called "17 Kalends of April".
METHODS
new( pattern => $string )
Creates a new formatter object. The optional formatting pattern defines the format of the output of format_datetime(). If no formatting pattern is given, a reasonable default is used.
format_datetime($datetime)
Retruns the formatted string. This method can be called on a formatter object (created by new()), or it can be called as a class method. In the latter case, the default pattern is used.
PATTERN SPECIFIERS
The following specifiers are allowed in the format strings given to the new() method:
%b
The abbreviated month name.
%B
The full month name.
%d
The day of the month as a decimal number (including 1 for the fixed days).
%D
The day of the month, written as a number plus the corresponding fixed day.
%f
The fixed day part of the date.
%m
The month as a decimal number (range 1 to 12).
%y
The year as a decimal number.
If a specifier is preceded by O or o, numbers will be written in uppercase and lowercase Roman numerals, respectively.
The %f specifier accepts an additional argument of 1 digit, specifying the length of the output:
%0f : abbreviated name (e.g. "Kal")
%1f : full name (e.g. "Kalends")
%2f : one-letter abbreviation (e.g. "K")
<<lessSYNOPSIS
use DateTime::Format::Roman;
my $formatter = DateTime::Format::Roman->new(
pattern => %d %f %b %y );
my $dt = DateTime->new( year => 2003, month => 5, day => 28 );
$formatter->format_datetime($dt);
# 5 Kal Jun 2003
This module formats dates in the Roman style.
The Romans expressed their dates in relation to three fixed dates per month. For example: the Ides of March was the 15th of that month; 14 March was called "2 Ides", 13 March was called "3 Ides", etcetera. The days in the second half of the month were named after the first day of the next month, the "Kalends"; e.g. 16 March was called "17 Kalends of April".
METHODS
new( pattern => $string )
Creates a new formatter object. The optional formatting pattern defines the format of the output of format_datetime(). If no formatting pattern is given, a reasonable default is used.
format_datetime($datetime)
Retruns the formatted string. This method can be called on a formatter object (created by new()), or it can be called as a class method. In the latter case, the default pattern is used.
PATTERN SPECIFIERS
The following specifiers are allowed in the format strings given to the new() method:
%b
The abbreviated month name.
%B
The full month name.
%d
The day of the month as a decimal number (including 1 for the fixed days).
%D
The day of the month, written as a number plus the corresponding fixed day.
%f
The fixed day part of the date.
%m
The month as a decimal number (range 1 to 12).
%y
The year as a decimal number.
If a specifier is preceded by O or o, numbers will be written in uppercase and lowercase Roman numerals, respectively.
The %f specifier accepts an additional argument of 1 digit, specifying the length of the output:
%0f : abbreviated name (e.g. "Kal")
%1f : full name (e.g. "Kalends")
%2f : one-letter abbreviation (e.g. "K")
Download (0.011MB)
Added: 2007-08-14 License: Perl Artistic License Price:
801 downloads
DateTime::Calendar::Hebrew 0.04
DateTime::Calendar::Hebrew is a Perl module with dates in the Hebrew calendar. more>>
DateTime::Calendar::Hebrew is a Perl module with dates in the Hebrew calendar.
SYNOPSIS
use DateTime::Calendar::Hebrew;
$dt = DateTime::Calendar::Hebrew->new( year => 5782,
month => 10,
day => 4 );
DateTime::Calendar::Hebrew is the implementation of the Hebrew calendar. Read on for more details on the Hebrew calendar.
<<lessSYNOPSIS
use DateTime::Calendar::Hebrew;
$dt = DateTime::Calendar::Hebrew->new( year => 5782,
month => 10,
day => 4 );
DateTime::Calendar::Hebrew is the implementation of the Hebrew calendar. Read on for more details on the Hebrew calendar.
Download (0.019MB)
Added: 2006-12-05 License: Perl Artistic License Price:
1055 downloads
Secleted [ 0 ] software to compare
Copyright Notice:
Software piracy is theft, Using crack, password, serial numbers, registration codes, key generators is illegal and prevent future software development. The above datetime search only lists software in full, demo and trial versions for free download. Download links are directly from our mirror sites or publisher sites, torrent files or links from rapidshare.com, yousendit.com or megaupload.com are not allowed