Gossamer Forum
Home : Products : DBMan : Customization :

Today's date changing

Quote Reply
Today's date changing
So I used the following code from the FAQ "Hello, today is . . ."
Code:

my ($sec, $min, $hour, $day, $mon, $year, $dweek, $dyear, $daylight) = localtime(time);
@Weekdays = (Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday);
$Date = &get_date;
print qq!
<p>$Weekdays[$dweek], $Date </p>


The date is correct on any page that does not have a record on it. It shows Dec 31, 1969, on the List All page. What is going on?

Chris
Quote Reply
Re: [jnjhost] Today's date changing In reply to
Where is the code?


JPD
----------------------------------------------------
JPDeni's DBMan-ual
How to ask questions the smart way.
Quote Reply
Re: [JPDeni] Today's date changing In reply to
sub html_header

Chris
Quote Reply
Re: [jnjhost] Today's date changing In reply to
Do you get the correct day of the week on all pages?


JPD
----------------------------------------------------
JPDeni's DBMan-ual
How to ask questions the smart way.
Quote Reply
Re: [JPDeni] Today's date changing In reply to
Yes, the same day of the week, but no matter the date, on the List All page, I get Dec 31, 1969.

Chris
Quote Reply
Re: [jnjhost] Today's date changing In reply to
Then I would suggest copying some of the code from sub get_date to your date routine in sub html_header:

Code:
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!;
my (@Weekdays) = (Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday);
($day < 10) and ($day = "0$day");
$year = $year + 1900;
print qq!
<p>$Weekdays[$dweek], $day-$months[$mon]-$year</p>

It's not that much code to repeat and we know that the date thing works with your weekday code, so this is the easiest way to work it out.


JPD
----------------------------------------------------
JPDeni's DBMan-ual
How to ask questions the smart way.
Quote Reply
Re: [JPDeni] Today's date changing In reply to
That worked!!!!! Thanks!!

Chris