Re: hour -1 routine

From: Anthony J Segelhorst (ajs15_at_meadwestvaco.com)
Date: 05/28/04


To: beginners@perl.org
Date: Fri, 28 May 2004 12:54:35 -0400

"Wiggins d Anconia" <wiggins@danconia.org> wrote on 05/28/2004 12:37:56
PM:

> >
> > 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,
>
> http://danconia.org

If I understand what you are saying about subtract 60 seconds in each of
60 minutes, how will this be able to handle:

        1. When it is 00:15, because if it is 00:15 I will actually want
23:15
        2. I can not just subtract 1 from the date because 010104 needs
to really be 123104.

If this is not what you are suggesting, let me know. You might be onto
something.

This is the part that is confusing me currently. I am just trying to get
logical understanding of what I want to do before I start writing the
code.

________________________________________________________________________
This email has been scanned for all viruses by the MessageLabs SkyScan
service._______________________________________________________________

This electronic message contains information from MeadWestvaco
Corporation or subsidiary companies, which may be confidential,
privileged or otherwise protected from disclosure. The
information is intended to be used solely by the recipient(s)
named. If you are not an intended recipient, be aware that
any review, disclosure, copying, distribution or use of this
transmission or its contents is prohibited. If you have
received this transmission in error, please notify MeadWestvaco
immediately at postmaster@MeadWestvaco.com.
_______________________________________________________________________



Relevant Pages

  • RE: Strange characters
    ... I installed Pod-Perldoc-3.12 and the latest version of perldoc but the ... Chetak Sasalu wrote: ... > this message and any attachments. ... you are not the intended recipient, please notify the sender at Wipro or Mailadmin@wipro.com immediately ...
    (perl.beginners)
  • Re: How to extract the path of the file name in perl
    ... especially the method: fileparse() ... Do: perldoc File::Basename ... Edward WIJAYA ... If you are not the intended recipient, please delete it and notify us immediately. ...
    (perl.beginners)
  • hour -1 routine
    ... privileged or otherwise protected from disclosure. ... If you are not an intended recipient, ... received this transmission in error, please notify MeadWestvaco ...
    (perl.beginners)
  • Re: hour -1 routine
    ... >privileged or otherwise protected from disclosure. ... If you are not an intended recipient, ... >received this transmission in error, please notify MeadWestvaco ...
    (perl.beginners)
  • Re: Automatically run programs at startup
    ... privileged or otherwise protected from disclosure. ... If you are not an intended recipient, be aware that any review, ... disclosure, copying, distribution or use of this transmission or its ... virus free. ...
    (microsoft.public.windowsxp.general)