Voilà : j'aimerai "convertir" le script ci-dessous en PHP pour qu'il ne fasse qu'afficher la date modifiée et non qu'il affiche ce bouton.
CODE-BOX
<script Language="JavaScript">
<!--
var zs;
function array(n) {
for (var i = 1; i <= n; i++) {
this[i] = 0
}
}
function patadate () {
now = new Date();
pt = new array(12);
pm = new array(12);
mm = new array(13);
pt[1] = 4;
pt[2] = 7;
pt[3] = 7;
pt[4] = 10;
pt[5] = 12;
pt[6] = 15;
pt[7] = 17;
pt[8] = 19;
pt[9] = 22;
pt[10] = 24;
pt[11] = 27;
pt[12] = 1;
pm[1] = 5;
pm[2] = 6;
pm[3] = 7;
pm[4] = 8;
pm[5] = 9;
pm[6] = 10;
pm[7] = 11;
pm[8] = 12;
pm[9] = 13;
pm[10] = 1;
pm[11] = 2;
pm[12] = 4;
mm[1] = "Absolu";
mm[2] = "Haha";
mm[3] = "As";
mm[4] = "Sable";
mm[5] = "Décervelage";
mm[6] = "Gueules";
mm[7] = "Pédales";
mm[8] = "Clinamen";
mm[9] = "Palotin";
mm[10] = "Merdre";
mm[11] = "Gidouille";
mm[12] = "Tatane";
mm[13] = "Phalle";
year = now.getYear();
if (year < 1900) {
year = year + 1900;
}
month = now.getMonth() + 1;
date = now.getDate();
pyear = (( month > 8 && date > 7 ) ? year - 1872 : year - 1873);
pdate = pt[month] + date - 1;
pmonth = pm[month];
r = year % 4
a = (( pm[month] == 11 ) || (( pm[month] == 6 ) && ( r == 0 )) ? 29 : 28);
if (pdate > a) {
pdate -= a;
pmonth++;
}
if ( pmonth > 13 ) {
pmonth = 1
}
pmname = mm[pmonth];
h = now.getHours();
m = now.getMinutes();
s = now.getSeconds();
zs= "" + pdate + " " + pmname + " " + pyear + " E.P.";
zs += " " + h;
zs += ((m < 10) ? ":0" : ":") + m;
zs += ((s < 10) ? ":0" : ":") + s;
document.dat.Datum.value = zs;
Timer = setTimeout("patadate()",1000);
}
// -->
</script>
<!--
var zs;
function array(n) {
for (var i = 1; i <= n; i++) {
this[i] = 0
}
}
function patadate () {
now = new Date();
pt = new array(12);
pm = new array(12);
mm = new array(13);
pt[1] = 4;
pt[2] = 7;
pt[3] = 7;
pt[4] = 10;
pt[5] = 12;
pt[6] = 15;
pt[7] = 17;
pt[8] = 19;
pt[9] = 22;
pt[10] = 24;
pt[11] = 27;
pt[12] = 1;
pm[1] = 5;
pm[2] = 6;
pm[3] = 7;
pm[4] = 8;
pm[5] = 9;
pm[6] = 10;
pm[7] = 11;
pm[8] = 12;
pm[9] = 13;
pm[10] = 1;
pm[11] = 2;
pm[12] = 4;
mm[1] = "Absolu";
mm[2] = "Haha";
mm[3] = "As";
mm[4] = "Sable";
mm[5] = "Décervelage";
mm[6] = "Gueules";
mm[7] = "Pédales";
mm[8] = "Clinamen";
mm[9] = "Palotin";
mm[10] = "Merdre";
mm[11] = "Gidouille";
mm[12] = "Tatane";
mm[13] = "Phalle";
year = now.getYear();
if (year < 1900) {
year = year + 1900;
}
month = now.getMonth() + 1;
date = now.getDate();
pyear = (( month > 8 && date > 7 ) ? year - 1872 : year - 1873);
pdate = pt[month] + date - 1;
pmonth = pm[month];
r = year % 4
a = (( pm[month] == 11 ) || (( pm[month] == 6 ) && ( r == 0 )) ? 29 : 28);
if (pdate > a) {
pdate -= a;
pmonth++;
}
if ( pmonth > 13 ) {
pmonth = 1
}
pmname = mm[pmonth];
h = now.getHours();
m = now.getMinutes();
s = now.getSeconds();
zs= "" + pdate + " " + pmname + " " + pyear + " E.P.";
zs += " " + h;
zs += ((m < 10) ? ":0" : ":") + m;
zs += ((s < 10) ? ":0" : ":") + s;
document.dat.Datum.value = zs;
Timer = setTimeout("patadate()",1000);
}
// -->
</script>