Re: hour -1 routine
From: Wiggins D Anconia (wiggins_at_danconia.org)
Date: 05/28/04
- Next message: U235sentinel: "Re: hour -1 routine"
- Previous message: Anthony J Segelhorst: "hour -1 routine"
- Maybe in reply to: Anthony J Segelhorst: "hour -1 routine"
- Next in thread: Anthony J Segelhorst: "Re: hour -1 routine"
- Reply: Anthony J Segelhorst: "Re: hour -1 routine"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 28 May 2004 10:37:56 -0600 To: "Anthony J Segelhorst" <ajs15@meadwestvaco.com>, beginners@perl.org
>
> I am trying to set up a script that will do the do a current time -1
> routine.
>
> Examples:
>
> Current Time:
> mmddyy:hhss
> 052804:1030
>
> Output:
> 052804:0930
>
>
> Current Time:
> 052704:0015
>
> Output:
> 052604:23:15
>
>
> I think the add_delta module is where I need to go, but I have never used
> modules before.
>
add_delta is probably a method/function in Date::Calc or Date::Manip
modules. But in this case is probably overkill.
You can use the built-in functions 'time' and 'localtime' to get the
desired effect.
perldoc -f time
perldoc -f localtime
'time' will return the current time, from which you can subtract 60*60
(60 seconds in each of 60 minutes), which gives 1 hour ago. You can then
use localtime to retrieve the values for the specific fields you need at
the calculated time. Alternatively you could use POSIX::strftime for
the formatting.
perldoc POSIX
HTH,
- Next message: U235sentinel: "Re: hour -1 routine"
- Previous message: Anthony J Segelhorst: "hour -1 routine"
- Maybe in reply to: Anthony J Segelhorst: "hour -1 routine"
- Next in thread: Anthony J Segelhorst: "Re: hour -1 routine"
- Reply: Anthony J Segelhorst: "Re: hour -1 routine"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|