PERL

By

Andrew Pitonyak


Home Book OpenOffice.org Macros My Macro Document Code Spam Perl My Perl Utilities 4NT batch files

I have two primary perl sections, my general utilities and my spam utilities. Just in case it is not obvious, the link general utilities loads a page that allows you to see these utilities including the source code. The other link, spam utilities, is for the same purpose.

General Utilites

Spam Utilites

These were written so that I could avoid spam on my computer. There is a better write-up here and the utilities are here.

Formatting And Extracting Dates And Times In Perl

There are two primary reasons that people come to my website if they do not already know me. The primary reason is of course Macro Programming using OpenOffice. The second reason is to try and figure out how to parse dates and times using PERL. If your only purpose in life is to format and use dates and times, then simply download a copy of my date utility code. You can see a pretty version of it if you like, or simply see how to use it.

If you want to do it the hard way - meaning you want to do it yourself - it is not that difficult. First, call the time() function to find out what time it is. Next, pass this value to localtime function to break this value into component pieces.

$a_time = time();
( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) = ( localtime($a_time) );

The returned year is the number of years from 1900, so the year 2004 is returned as 104. Boy did this annoy some of my PERL programming friends! I must admit that I used some interesting code in the time_date_str routine, take a look at it. If there is call for it, then I will provide some more information.


Last Modified January 13, 2005 11:53:21 PM EST© 1999-2008 Andrew Pitonyak (email me at: andy @ pitonyak.org)