Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

(Date::) Re: Two Weeks

by mwp (Hermit)
on Nov 20, 2000 at 20:25 UTC ( #42518=note: print w/replies, xml ) Need Help??

in reply to Two Weeks

Date::Manip, or if you need the speed Date::Calc. =)

"Who gave HIM a Perl interpreter?!"


#!/usr/bin/perl -w use strict; use Date::Manip qw(ParseDate DateCalc UnixDate); foreach my $i (0..13) { # create a date by subtracting iterator ($i) days from today my $date = &DateCalc('today', "-$i days"); # print the formatted date (DDmmmYY) print &UnixDate($date, '%d%b%y'), "\n"; }

merlyn's example is far superior to both Date::Manip and Date::Calc, and you should use that instead if you can.

Replies are listed 'Best First'.
Re: (Date::) Re: Two Weeks
by ImpalaSS (Monk) on Nov 20, 2000 at 20:34 UTC
    One of the problems is i cannot install any modules, for many reasons. Is there a way i can do this w/o the use of a module/funcion that isnt built into perl?


      If you are using ActiveState's Perl for Win32, use PPM. If you are having trouble in Unix, as an alternative to perl -MCPAN -e shell try:
      1. Download the module from CPAN.
      2. Extract the files with tar.
      3. Descend into the module directory and run:
        perl Makefile.PL && make && make check && make install

      And that should do it!

      "Who gave HIM a Perl interpreter?!"

        With ActiveState, Date::Calc is already installed
      ImpallaSS, Go to whoever's in charge of these things and say : "I can do this in $time the way things are currently set up. However, if you give me access to the tools I need, including the ability to get modules installed, it could be $time2, saving the company $lots."

      It might be that they have a sysadmin install the modules for you; you might not need to do it on your own. But, based on some of the talk we've had in the chatterbox, you're trying to do a complicated thing that could be simplified a hundred fold if you had access to the correct tools. Explain to management what you need, and why. Present your case in terms of money saved, or time saved.

      You can install modules for your own personal use. I can't install any since I don't have root access here at the university.

      After much searching I discovered if you do:

      perl Makefile.PL LIB='/some/dir' PREFIX='/some/dir'

      You can then use modules you install in /some/dir. You just add:

      use LIB '/some/dir'

      in the top of your Perl program.

      Learning Perl or Going To Die Trying

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://42518]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2022-11-30 03:11 GMT
Find Nodes?
    Voting Booth?