[WEB4LIB] $date_command path in NT

Darryl Friesen Darryl.Friesen at usask.ca
Tue Nov 28 16:51:16 EST 2000


>I'm thinking it has something to do with this line:
>
> $date_command = "/usr/bin/date";
>
> But I'm not sure how to proceed from here?

Yep, that's the problem.  Lazy programming (that being said, I usually do
the same thing).  Later on in the script there's probably a line like one of
the following:

     $date = system($date_command);
     $date = `$date_command`;
     print `$date_command`;

or something similar.  You'll need to doctor that up since NT machines don't
have the same kind of date command as Unix machines.  Instead, use something
like:

     $date = localtime();
or
     print localtime();

That will give you a date like: "Tue Nov 28 15:44:47 2000".  Formatting it a
differently is a little more work.  Used in an array context [i.e.
@components = localtime() ] localtime will return the component elements of
the current date/time, then you can format it however you choose.  Check the
docs on the localtime function.


- Darryl

 ----------------------------------------------------------------------
  Darryl Friesen, B.Sc., Programmer/Analyst    Darryl.Friesen at usask.ca
  Education & Research Technology Services,     http://gollum.usask.ca/
  Department of Computing Services,
  University of Saskatchewan
 ----------------------------------------------------------------------
  "Go not to the Elves for counsel, for they will say both no and yes"




More information about the Web4lib mailing list