What day is it (in PERL)?

Moonsinger

Settler
Retired Moderator
Joined
Apr 22, 2002
Messages
4,374
Location
Iowa
A quick question:

In PERL, for a given date, is there a built-in function to tell me the day of the week?

For example: Given date = 11/18/2003
Answer: it's Tuesday or day 2 of the week (Sunday = 0, Monday = 1, ....)

Many thanks in advance for an answer. I have searched through two different books of Perl already and haven't found any built-in date function yet. I'm not sure how to handle it in Perl.
:confused:
 
Here 's a link I found when searched on google. I don't know anything about PERL though, so I can't really say if it is what you really want.
 
Originally posted by funxus
Here 's a link I found when searched on google. I don't know anything about PERL though, so I can't really say if it is what you really want.

Thank you very much!:) That will do.:)
 
Here is what I finally ended up with:

print (localtime(time()))[6];

It may see like a piece of cake now, but it took me forever to find it.:(
 
Doing it in C/C++, VB, and Delphi are easy. However, the answer that I was looking for must be in Perl.
 
Originally posted by ainwood
You could write a C DLL, and call it from Perl. :mischief:

True! However, I'm on a UNIX system (Solaris) and Solaris doesn't do DLL. Of course, I could always write a little shell script or even a C program and call it from Perl, but that would be very uncool.;)
 
Ah, Solaris, my favorite!
You could have man'd date and called to that from Perl. :) But it is better to do it all in native Perl, IMHO.

What kind of work you doing Moonsinger? I load Solaris systems all the time for my work place (we do software dev for Solaris 2.51, 7, 8, Windows NT, 2K, and XP oh, and HP-UX, aack). Most of the work is in java but there is a lot of scripting done too, oh and .NET and VB and a bit of C/C++ thrown in for added confusion.
 
Originally posted by munzy
What kind of work you doing Moonsinger?

Well, I used to be a Systems Analyst seven years ago. Since then, I have been given a more sophisticate tile (I don't remember what it's on paper now because it has been constantly changing every year; even if I remember it, I can't tell you because you would know who I am in RL). I mostly work on vaious research projects nowadays. Basically, I'm full of strange ideas and theories, but when it comes to actual implementation, I don't know much.;)
 
Originally posted by ainwood
So, you're that famous, huh? :D

May be!;) However, I'm sure at least 1 person in every state in the US have heard about me in RL. Therefore, it doesn't take much to track me down.;)
 
Moonsinger, you are truely wierd. ;)

PS: My current title is Configuration Analyst 2
 
Top Bottom