|
|
![]() |
| Thread Tools | Search this Thread |
#1
| |||
| |||
How to use PHP get year in firefox ? Hello, I would use the getYear in FireFox, but it does not display correctly. Code: <html> <body> <script type="text/javascript"> var d = new Date () document.write ( "2005 -" + d.getYear ()) </ script> </ body> </ html> Perfect in IE but in FireFox, nothing works (bad display). Can anyone help me? Thank you very much! |
#2
| |||
| |||
Re: How to use PHP get year in firefox ? Did you think of those who have javascript disabled? Your site should work well without javascript. The javascript in my opinion just to serve retail, to make something nice (like holding a CSS) and should not be essential for the proper functioning of your site. |
#3
| |||
| |||
Re: How to use PHP get year in firefox ? You should be use getFullYear () instead of getYear (); Before 2000, getYear () returned 98 for 1998. Firefox has therefore continue as follows: 1999 = 99 and therefore 2000 = 100 2001 = 101 ... etc Javascript is very useful and it depends on what tests you do. getFullYear () you will return in 2006 in Firefox and IE ... or you can use getYear () and simply add 1900 if necessary: var d = new Date (); var year = d.getFullYear (); Code only for the year: Code: Date.prototype.getTwoDigitYear = function () {return /(\d{2})$/.test (this.getFullYear()) ? RegExp.$1 : this} |
![]() |
|
Tags: firefox, get year, php |
Thread Tools | Search this Thread |
|
![]() | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Will the Serious Sam 3: BFE be the best game of the year? | PurviJ | Video Games | 8 | 27-11-2011 06:47 PM |
Download Firefox Aurora, Firefox Nightly and Firefox Beta | Johnny | Web News & Trends | 1 | 21-08-2011 05:02 PM |
Firefox Announces Firefox 6 Beta and Firefox 7 Aurora | Eseld | Technology & Internet | 5 | 20-07-2011 07:48 PM |
How to write a program to determine if year is leap year or not | Luis-Fernando | Software Development | 4 | 30-11-2009 05:21 PM |
How to get out of 2 year contract with AT&T | Zacharia | Portable Devices | 3 | 24-08-2009 06:10 PM |