# Date Question

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

2. &lt;disclaimer&gt; I don't know php but I've just begun to have a need for it... &lt;/disclaimer&gt;
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.

3. yer working a math problem with strings - not good, lol

before you output the string, do a little math first:
<pre class="ip-ubbcode-code-pre">
\$4dyear = 1900 + \$year;
print \$4dyear;
</pre>
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...

4. ### Newsletter Signup

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•