bazz
03-31-2005, 06:12 PM
HI,
here's a script I found and which outputs the time as yyyymmdd. I want to modify it to output the date as, 1st (or 2nd 3rd 4th etc), September yyyy.
I haven't a clue which bits to change so any pointers (without actually doing it for me), would be appreciated. I've searched but don't seem to find this specific piece.
I'm away now to look up the possibility that an array might be useful eg:
@month (January, February, March, April, May, June, July, August, September, October, November, December); but I can see that there isnt yet a tie in between this data and the top line of the code.
###################################
#GET THE TIME AND DATE
###################################
($second, $minute, $hour, $day, $month, $year, $weekday, $dayofyear, $isdst) = localtime(time);
$dayofyear++;
if ($day < 10) { $day = 0 . $day; }
if ($month < 10) { $month = 0 . $month; } $month++;
$hour = &hours($hour);
$minute = &minutes($minute);
$year += 1900;
$site_time = "$hour:$minute (GMT)";
$site_date = "$year/$month/$day";
sub minutes {
$minute = shift;
if ($minute < "10") {
$minute = 0 . $minute;
return $minute;
} else {
return $minute;
}
}
sub hours {
$hour = shift;
if ($hour > 15) {
$hour += 8;
if ($hour > 24) {
$hour -= 24;
}
return $hour;
} else {
$hour += 8;
return $hour;
}
}
Bazz
here's a script I found and which outputs the time as yyyymmdd. I want to modify it to output the date as, 1st (or 2nd 3rd 4th etc), September yyyy.
I haven't a clue which bits to change so any pointers (without actually doing it for me), would be appreciated. I've searched but don't seem to find this specific piece.
I'm away now to look up the possibility that an array might be useful eg:
@month (January, February, March, April, May, June, July, August, September, October, November, December); but I can see that there isnt yet a tie in between this data and the top line of the code.
###################################
#GET THE TIME AND DATE
###################################
($second, $minute, $hour, $day, $month, $year, $weekday, $dayofyear, $isdst) = localtime(time);
$dayofyear++;
if ($day < 10) { $day = 0 . $day; }
if ($month < 10) { $month = 0 . $month; } $month++;
$hour = &hours($hour);
$minute = &minutes($minute);
$year += 1900;
$site_time = "$hour:$minute (GMT)";
$site_date = "$year/$month/$day";
sub minutes {
$minute = shift;
if ($minute < "10") {
$minute = 0 . $minute;
return $minute;
} else {
return $minute;
}
}
sub hours {
$hour = shift;
if ($hour > 15) {
$hour += 8;
if ($hour > 24) {
$hour -= 24;
}
return $hour;
} else {
$hour += 8;
return $hour;
}
}
Bazz