In een van mijn scripts wordt de datum weergegeven, maar ik krijg het maar niet voor elkaar om deze in het Nederlands te krijgen. Het gaat om de letter F
Hieronder vind je een stukje code:
Ik heb in .js het volgende gevonden:PHP Code:
<?php echo "$person || ".date("j F Y", strtotime($datesel));?></h1>
Wat ik ook invul het wil maar niet veranderen. Wie weet wat ik fout doe, of zit ik bij het verkeerde bestand te kijken?PHP Code:
/ Simulates PHP's date function
Date.prototype.format = function(format) {
var returnStr = '';
var replace = Date.replaceChars;
for (var i = 0; i < format.length; i++) {
var curChar = format.charAt(i);
if (replace[curChar]) {
returnStr += replace[curChar].call(this);
} else {
returnStr += curChar;
}
}
return returnStr;
};
Date.replaceChars = {
shortMonths: ['Jan', 'Feb', 'Maer', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
longMonths: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
shortDays: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
longDays: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
// Day
d: function() { return (this.getDate() < 10 ? '0' : '') + this.getDate(); },
D: function() { return Date.replaceChars.shortDays[this.getDay()]; },
j: function() { return this.getDate(); },
l: function() { return Date.replaceChars.longDays[this.getDay()]; },
N: function() { return this.getDay() + 1; },
S: function() { return (this.getDate() % 10 == 1 && this.getDate() != 11 ? 'st' : (this.getDate() % 10 == 2 && this.getDate() != 12 ? 'nd' : (this.getDate() % 10 == 3 && this.getDate() != 13 ? 'rd' : 'th'))); },
w: function() { return this.getDay(); },
z: function() { return "Not Yet Supported"; },
// Week
W: function() { return "Not Yet Supported"; },
// Month
F: function() { return Date.replaceChars.longMonths[this.getMonth()]; },
m: function() { return (this.getMonth() < 9 ? '0' : '') + (this.getMonth() + 1); },
M: function() { return Date.replaceChars.shortMonths[this.getMonth()]; },
n: function() { return this.getMonth() + 1; },
t: function() { return "Not Yet Supported"; },
// Year
L: function() { return "Not Yet Supported"; },
o: function() { return "Not Supported"; },
Y: function() { return this.getFullYear(); },
y: function() { return ('' + this.getFullYear()).substr(2); },
// Time
a: function() { return this.getHours() < 12 ? 'am' : 'pm'; },
A: function() { return this.getHours() < 12 ? 'AM' : 'PM'; },
B: function() { return "Not Yet Supported"; },
g: function() { return this.getHours() % 12 || 12; },
G: function() { return this.getHours(); },
h: function() { return ((this.getHours() % 12 || 12) < 10 ? '0' : '') + (this.getHours() % 12 || 12); },
H: function() { return (this.getHours() < 10 ? '0' : '') + this.getHours(); },
i: function() { return (this.getMinutes() < 10 ? '0' : '') + this.getMinutes(); },
s: function() { return (this.getSeconds() < 10 ? '0' : '') + this.getSeconds(); },
// Timezone
e: function() { return "Not Yet Supported"; },
I: function() { return "Not Supported"; },
O: function() { return (-this.getTimezoneOffset() < 0 ? '-' : '+') + (Math.abs(this.getTimezoneOffset() / 60) < 10 ? '0' : '') + (Math.abs(this.getTimezoneOffset() / 60)) + '00'; },
T: function() { var m = this.getMonth(); this.setMonth(0); var result = this.toTimeString().replace(/^.+ \(?([^\)]+)\)?$/, '$1'); this.setMonth(m); return result;},
Z: function() { return -this.getTimezoneOffset() * 60; },
// Full Date/Time
c: function() { return "Not Yet Supported"; },
r: function() { return this.toString(); },
U: function() { return this.getTime() / 1000; }
};
- maanden omzetten van EN -> NL
-
06-03-2012, 22:03 #1
- Berichten
- 316
- Lid sinds
- 17 Jaar
maanden omzetten van EN -> NL
-
-
06-03-2012, 22:18 #2
- Berichten
- 454
- Lid sinds
- 14 Jaar
Re: maanden omzetten van EN -> NL
shortMonths: ['Jan', 'Feb', 'Maer', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
longMonths: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
shortDays: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
longDays: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
-
06-03-2012, 22:33 #3
- Berichten
- 316
- Lid sinds
- 17 Jaar
Re: maanden omzetten van EN -> NL
Dan moet het allemaal werken?
Ik heb de maanden al aangepast, maar dat had geen resultaat.
Aanvullend bericht:
ik heb het volgende gedaan, maar geen resultaat:
Date.replaceChars = {
shortMonths: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
longMonths: ['Januarie', 'Februari', 'Maart', 'April', 'Mei', 'Juni', 'Juli', 'Augustus', 'September',
'Oktober', 'November', 'December'],
shortDays: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
longDays: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
Het gaat puur om de "F". De rest lijkt me dan niet relevant of zie ik het fout.Laatst aangepast door LéonH : 06-03-2012 om 22:37 Reden: Automatisch samengevoegd.
-
06-03-2012, 22:41 #4gast16278 Guest
Re: maanden omzetten van EN -> NL
PHP Code:date("j F Y", strtotime($datesel)
Zet helemaal bovenaan die pagina eens:
PHP Code:<?php
setlocale(LC_TIME, 'NL_nl');
?>
-
06-03-2012, 22:48 #5
- Berichten
- 66
- Lid sinds
- 14 Jaar
Re: maanden omzetten van EN -> NL
Daar komt nog eens bij dat date() daar niet mee werkt maar strftime() gebruikt moet worden. Overigens is deze info allemaal eenvoudig op www.php.net te vinden.
-
06-03-2012, 22:53 #6
- Berichten
- 316
- Lid sinds
- 17 Jaar
Re: maanden omzetten van EN -> NL
Bedankt voor de reacties. Ik zal me er "even" in gaan verdiepen. Voorlopig heb ik er '' n '' van gemaakt. Nu staat er bijv. 6 - 3 - 2012. Dat is iig beter dan de Engelse maanden.
Plaats een
- + Advertentie
- + Onderwerp
Marktplaats
Webmasterforum
- Websites algemeen
- Sitechecks
- Marketing
- Domeinen algemeen
- Waardebepaling
- CMS
- Wordpress
- Joomla
- Magento
- Google algemeen
- SEO
- Analytics
- Adsense
- Adwords
- HTML / XHTML
- CSS
- Programmeren
- PHP
- Javascript
- JQuery
- MySQL
- Ondernemen algemeen
- Belastingen
- Juridisch
- Grafisch ontwerp
- Hosting Algemeen
- Hardware Info
- Offtopic