Download Shareware and Freeware Software for Windows, Linux, Macintosh, PDA

line Home  |  About Us  |  Link To Us  |  FAQ  |  Contact

Serving Software Downloads in 956 Categories, Downloaded 50.214.449 Times

Time::Format 1.02

  Date Added: April 04, 2010  |  Visits: 1.282

Time::Format

Report Broken Link
Printer Friendly Version


Product Homepage
Download (94 downloads)



Time::Format is a Perl module for easy-to-use date/time formatting. SYNOPSIS use Time::Format qw(%time %strftime %manip); $time{$format} $time{$format, $unixtime} print "Today is $time{yyyy/mm/dd}n"; print "Yesterday was $time{yyyy/mm/dd, time-24*60*60}n"; print "The time is $time{hh:mm:ss}n"; print "Another time is $time{H:mm am tz, $another_time}n"; print "Timestamp: $time{yyyymmdd.hhmmss.mmm}n"; %time also accepts Date::Manip strings and DateTime objects: $dm = Date::Manip::ParseDate(last monday); print "Last monday was $time{Month d, yyyy, $dm}"; $dt = DateTime->new (....); print "Heres another date: $time{m/d/yy, $dt}"; It also accepts most ISO-8601 date/time strings: $t = 2005/10/31T17:11:09; # date separator: / or - or . $t = 2005-10-31 17.11.09; # in-between separator: T or _ or space $t = 20051031_171109; # time separator: : or . $t = 20051031171109; # separators may be omitted $t = 2005/10/31; # date-only is okay $t = 17:11:09; # time-only is okay # But not: $t = 20051031; # date-only without separators $t = 171109; # time-only without separators # ...because those look like epoch time numbers. %strftime works like POSIXs strftime, if you like those %-formats. $strftime{$format} $strftime{$format, $unixtime} $strftime{$format, $sec,$min,$hour, $mday,$mon,$year, $wday,$yday,$isdst} print "POSIXish: $strftime{%A, %B %d, %Y, 0,0,0,12,11,95,2}n"; print "POSIXish: $strftime{%A, %B %d, %Y, 1054866251}n"; print "POSIXish: $strftime{%A, %B %d, %Y}n"; # current time %manip works like Date::Manips UnixDate function. $manip{$format}; $manip{$format, $when}; print "Date::Manip: $manip{%m/%d/%Y}n"; # current time print "Date::Manip: $manip{%m/%d/%Y,last Tuesday}n"; These can also be used as standalone functions: use Time::Format qw(time_format time_strftime time_manip); print "Today is ", time_format(yyyy/mm/dd, $some_time), "n"; print "POSIXish: ", time_strftime(%A %B %d, %Y,$some_time), "n"; print "Date::Manip: ", time_manip(%m/%d/%Y,$some_time), "n"; This module creates global pseudovariables which format dates and times, according to formatting codes you pass to them in strings. The %time formatting codes are designed to be easy to remember and use, and to take up just as many characters as the output time value whenever possible. For example, the four-digit year code is "yyyy", the three-letter month abbreviation is "Mon". The nice thing about having a variable-like interface instead of function calls is that the values can be used inside of strings (as well as outside of strings in ordinary expressions). Dates are frequently used within strings (log messages, output, data records, etc.), so having the ability to interpolate them directly is handy. Perl allows arbitrary expressions within curly braces of a hash, even when that hash is being interpolated into a string. This allows you to do computations on the fly while formatting times and inserting them into strings. See the "yesterday" example above. The format strings are designed with programmers in mind. What do you need most frequently? 4-digit year, month, day, 24-based hour, minute, second -- usually with leading zeroes. These six are the easiest formats to use and remember in Time::Format: yyyy, mm, dd, hh, mm, ss. Variants on these formats follow a simple and consistent formula. This module is for everyone who is weary of trying to remember strftime(3)s arcane codes, or of endlessly writing $t[4]++; $t[5]+=1900 as you manually format times or dates. Note that mm (and related codes) are used both for months and minutes. This is a feature. %time resolves the ambiguity by examining other nearby formatting codes. If its in the context of a year or a day, "month" is assumed. If in the context of an hour or a second, "minute" is assumed. The format strings are not meant to encompass every date/time need ever conceived. But how often do you need the day of the year (strftimes %j) or the week number (strftimes %W)? For capabilities that %time does not provide, %strftime provides an interface to POSIXs strftime, and %manip provides an interface to the Date::Manip modules UnixDate function. If the companion module Time::Format_XS is also installed, Time::Format will detect and use it. This will result in a significant speed increase for %time and time_format..

Requirements: No special requirements
Platforms: Linux
Keyword: Format Libraries Perl Module Posixish Print Programming Strftime Time Timeformat
Users rating: 0/10

License: Freeware Size: 38.91 KB
USER REVIEWS
More Reviews or Write Review


TIME::FORMAT RELATED
Libraries  -  Time::Piece 1.11
Time::Piece is a Perl module that contains Object Oriented time objects. SYNOPSIS use Time::Piece; my $t = localtime; print "Time is $tn"; print "Year is ", $t->year, "n"; This module replaces the standard localtime and gmtime functions...
20.48 KB  
Libraries  -  Devel::Hints 0.11
Devel::Hints is a Perl module created to access compile-time hints at runtime. SYNOPSIS use Devel::Hints :all; LABEL: print cop_label(); # LABEL cop_label(0 => FOO); # "goto FOO;" is valid after this point! print cop_file(); # same as...
44.03 KB  
Libraries  -  Alien Perl module 0.91
Alien Perl module package contains external libraries wrapped up for your viewing pleasure! SYNOPSIS perldoc Alien; Alien is a package that exists just to hold together an idea, the idea of Alien:: packages, so there is no code here, just...
10.24 KB  
Libraries  -  OpenGeoDB Perl module 0.4
OpenGeDB Perl module is a module to access the OpenGeoDB database and calculate all ZIP codes in a certain radius..
3.07 KB  
Libraries  -  Acme::EyeDrops 1.51
Acme::EyeDrops is a Perl module for visual programming in Perl. SYNOPSIS use Acme::EyeDrops qw(sightly); print sightly( { Shape => camel, SourceFile => eyesore.pl } ); Acme::EyeDrops converts a Perl program into an equivalent one, but...
102.4 KB  
Network & Internet  -  MyCMS perl module 1.0
MyCMS perl module provides the MN::CMS Perl module used by the MyCMS. MyCMS perl module contains Perl object classes to manage the data of MyCMS (such as articles, links, and images). MN::CMS is a perl module that allows you to manage an...
16.38 KB  
Libraries  -  Time::Beat 1.21
Time::Beat is a Perl module to convert between standard time and Swatch ".beat" time. Time::Beat is a module to convert normal time to and from .beats, of which there are a thousand in a day. It can change normal time in time() format to .beats,...
3.07 KB  
Libraries  -  Scalar::Properties 0.12
Scalar::Properties is a Perl module package that contains run-time properties on scalar variables. SYNOPSIS use Scalar::Properties; my $val = 0->true; if ($val && $val == 0) { print "yup, its true alright...n"; } my @text = ( hello...
10.24 KB  
Libraries  -  Geo::Lookup::ByTime 0.0.2
Geo::Lookup::ByTime is a Perl module to lookup location by time. SYNOPSIS use Geo::Lookup::ByTime; $lookup = Geo::Lookup::ByTime->new( @points ); my $pt = $lookup->nearest( $tm ); Given a set of timestamped locations guess the location at...
15.36 KB  
Libraries  -  HTML::FormatNroff 0.11
HTML::FormatNroff is a Perl module that can format HTML as nroff man page. SYNOPSIS require HTML::FormatNroff; $html = parse_htmlfile("test.html"); $format_nroff = new HTML::FormatNroff(name => trial, project => MyProject); print...
12.29 KB  
NEW DOWNLOADS IN PROGRAMMING, LIBRARIES
Programming  -  Cedalion for Linux 0.2.6
Cedalion is a programming language that allows its users to add new abstractions and define (and use) internal DSLs. Its innovation is in the fact that it uses projectional editing to allow the new abstractions to have no syntactic limitations.
471.04 KB  
Programming  -  Math::GMPf 0.29
Math::GMPf - perl interface to the GMP library's floating point (mpf) functions.
30.72 KB  
Programming  -  Net::Wire10 1.08
Net::Wire10 is a Pure Perl connector that talks to Sphinx, MySQL and Drizzle servers. Net::Wire10 implements the low-level network protocol, alias the MySQL wire protocol version 10, necessary for talking to one of the aforementioned...
30.72 KB  
Programming  -  logilab-common 0.56.2
a bunch of modules providing low level functionnalities shared among some python projects devel Please note that some of the modules have some extra dependencies. For instance, logilab.common.db will require a db-api 2.0 compliant...
174.08 KB  
Programming  -  OpenSSL for linux 1.0.0a
The OpenSSL Project is a collaborative effort to develop a robust, commercial-grade, full-featured, and Open Source toolkit implementing the Secure Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS v1) protocols as well as a...
3.83 MB  
Libraries  -  wolfSSL 4.0.0
The wolfSSL embedded SSL/TLS library is a lightweight SSL library written in ANSI standard C and targeted for embedded and RTOS environments - primarily because of its small size, speed, and feature set. It is commonly used in standard operating...
3.88 MB  
Libraries  -  EuGTK 4.8.9
Makes it easy to develop good- looking, fast, cross-platform programs that run on Linux, OS X, and Windows. Euphoria is a very fast interpreted/compiled language with straight-forward syntax. EuGTK allows programming in a clean, object-oriented...
10.68 MB  
Libraries  -  Linux User Group Library Manager 1.0
The LUG Library Manager is a project to help Linux User Groups start their own library. A LUG library is helpful to the community at large because it increases access to information, and gives everyone the opportunity to become more knowledgeable.
5.35 KB  
Libraries  -  Module::MakefilePL::Parse 0.12
Module::MakefilePL::Parse is a Perl module to parse required modules from Makefile.PL. SYNOPSIS use Module::MakefilePL::Parse; open $fh, Makefile.PL; $parser = Module::MakefilePL::Parse->new( join("", ) ); $info = $parser->required;...
8.19 KB  
Libraries  -  sqlpp 0.06
sqlpp Perl package is a SQL preprocessor. sqlpp is a conventional cpp-alike preprocessor taught to understand SQL ( PgSQL, in particular) syntax specificities. In addition to the standard #define/#ifdef/#else/#endif cohort, provides also...
10.24 KB