automatic fill of day field
How do I create a function that will automatically fill my "day" field (on my database file) with 3-char such as 'Mon', 'Tue', etc depending on what day it gets from a linux system? Something like the following only alpha-formatted on my day .
$time1 = @_[0];
($time1) or ($time1 = time());
my ($sec, $min, $hour, $day, $mon, $year, $dweek, $dyear, $daylight) = localtime(time());
my (@months) = qw!Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec!;
($day < 10) and ($day = "0$day");
$year = $year + 1900;
return "$day-$months[$mon]-$year";
Suzanne posted this at 18:54 — 16th November 2000.
She has: 5,507 posts
Joined: Feb 2000
How entertaining!
You need to make a list of the days and map them over so that $days[0] = Sunday or whatever.
Suzanne
Rob Pengelly posted this at 20:56 — 16th November 2000.
They have: 850 posts
Joined: Jul 1999
Are you just trying to get the current day? If so try using:
my $time = substr(localtime(),0,3);
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.