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

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

Serving Software Downloads in 976 Categories, Downloaded 29.547.507 Times

Time::Format 1.02

  Date Added: April 04, 2010  |  Visits: 720

Time::Format

Report Broken Link
Printer Friendly Version


Product Homepage
Download (72 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  -  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  
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  -  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  -  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  
Libraries  -  Text::EtText::EtText2HTML 2.2
Text::EtText::EtText2HTML is a Perl module to convert from the simple EtText editable-text format into HTML. SYNOPSIS my $t = new Text::EtText::EtText2HTML; print $t->text2html ($text); or my $t = new Text::EtText::EtText2HTML; print...
143.36 KB  
Libraries  -  Lingua::ZH::Currency::UpperCase 0.01
Lingua::ZH::Currency::UpperCase is a Perl module to convert Currency Numbers to Chinese UpperCase Format. SYNOPSIS use Lingua::ZH::Currency::UpperCase; print chinese_currency_uc( 2504.39 ); The main subroutine get a number and give a...
3.07 KB  
NEW DOWNLOADS IN PROGRAMMING, LIBRARIES
Programming  -  FLEX-db Digital Asset Manager 3.0.9
FLEX-db - an enterprise Digital Asset Manager (DAM). It ingests and links metadata with files, creates thumbnails, and processes files using business rules. FLEX-db has a JSP client, Java app server for file input and output and an EJB metadata...
21.57 MB  
Programming  -  Libicom 0.9.0
The libicom library is a character based dynamicly linked library for Linux. It is used to remotely control the Icom IC-R8500 wide band receiver via an RS232 link. All call and return parameters to the control functions are character string based....
20.48 KB  
Programming  -  dotdesktop 0.3
Dotdesktop library provides ability to parse desktop entry file and access the information in a convenient way. Desktop entry file format is defined by freedesktop.org, it is used to describe information about an application such as the name and...
327.68 KB  
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  -  libyasl 0.2
Libyasl is a C++ class library to easily realize TCP/UDP/Multicast clientsand servers in IPv4 and IPv6 environments under GNU/Linux systems.
143.36 KB  
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  
Libraries  -  App::SimpleScan::Substitution::Line 2.02
App::SimpleScan::Substitution::Line is a line with optional fixed variable values. SYNOPSIS my $line = App::SimpleScan::Substitution::Line->new(" this "); # Use only this value when substituting " ". $line->fix(substituite =>...
54.27 KB