Results 1 to 3 of 3
September 30th, 2002, 09:53 PM #1
After much head banging over a simple error (thanks, Tom [img]/infopop/emoticons/icon_smile.gif[/img] ) I got what should have been a really simple guestbook script working at our Scout Troup's website.
BUT, upon looking at the entries (after messing up and overwriting a few -- it's been a looong day!) the date contains a two year old problem.
The date shows up as follows: Tuesday, October 1, 19102 at 01:06:19
Sigh...so I found the line of code for the date. It is: 19$year So it's obvious that the "19" has to go but what's the right way to do this?
Change it to 20 then minus 100? (if you don't minus 100 adding the 20 would give you 20102)
How would you go about doing this? Is it as simple as something like 20$year(-100) or am I barking up the wrong tree with this line of thought?
'Veni, Vidi, Velcro' - I came, I saw, I stuck around
October 4th, 2002, 07:58 PM #2
- Join Date
- January 17th, 2005
<disclaimer> I don't know php but I've just begun to have a need for it... </disclaimer>
From what I can tell it is outputing "19" and then the variable "$year" which you designed to be only the last two digits of the current year. But now that number has increased to 3 digits and so it's broken... Uh oh, I just lost my motivation to explain everything that's going on! So the real way to fix it would be to make $year hold all of the digits for the current year so you'd have to store 2002 into it and then change the script to only write $year (without the 19 in front). In case you can't change $year (since I don't actually know php yet it could be a built-in variable...), the cheap-hack way would be to do what you came up with but it would probably cause all the 1900 dates to become 2000's.
December 9th, 2002, 12:14 AM #3
yer working a math problem with strings - not good, lol
before you output the string, do a little math first:
$4dyear = 1900 + $year;
Or, even better, alter your guestbook script to use unix time offsets (the count of the number of seconds which have elapsed since 00:00, 1 Jan 1970) formatted with php's date() function...
By markwelch in forum ShareASale - SASReplies: 2Last Post: February 14th, 2007, 08:34 PM
By ~Michelle in forum Midnight Cafe'Replies: 0Last Post: August 21st, 2006, 09:50 AM
By steveyoung in forum WebMerge (Fourthworld.com)Replies: 2Last Post: May 1st, 2006, 01:02 PM
By DHolland in forum Midnight Cafe'Replies: 2Last Post: October 4th, 2005, 12:16 PM