Hello,
What is the easiest and best way to display the current year on a web page?
Thanks,
Lavern
Hello,
What is the easiest and best way to display the current year on a web page?
Thanks,
Lavern
easiest and best? in my opinion, you hardcode it
first of all, that is the easiest, hands down – it’s only 4 keystrokes!!!
secondly, it’s better than using javascript, because then you’d need to have a NOSCRIPT alternative, in which you would have to—you guessed it—hardcode it
actually, using a server-side solution, such as php, asp, coldfusion, might be even better (although not easier) because then you wouldn’t have to change it every year
of course, you’d need to do a net present value cost analysis of how much time it will take you to implement a server-side solution now, as compared to how many times you expect to have to edit those 4 hardcoded characters in the future…
so unless you’re already using a server-side language, i’d say just hardcode it
You specifically asked for an HTML solution, which can only be hardcoded.
If you are willing to accept a non-HTML solution, almost all hosts now a days have PHP support built in. Simply change the extension of your HTML file to .php and add this one line:
<?php echo date("Y"); ?>
Not too complicated. Hope one of the answers works for you.
Thanks for your input.
OK, I like the idea of using PHP. My pages are already PHP. Sorry, I shouldn’t have mentioned HTML.
The poster before you gave you the solution.
I know. And my pages are already PHP, so it will work great!