...

View Full Version : Date in Dutch



maarten64
11-01-2012, 01:08 PM
Hi there,

I need to replace the following code, with something in which I can localize the date (months), e.g. 1 okt (instead of oct).

Can someone please help me? I've tried a lot of different 'solutions' but my js knowlegde is very limited so I'm kind of looking for a copy-paste solution.



// Give the tweet a nice timestamp
var formatTime = function(pastTime) {
/* Credits to: Zemanta */
var origStamp = Date.parse(pastTime);
var curDate = new Date();
var currentStamp = curDate.getTime();

var difference = parseInt((currentStamp - origStamp)/1000);

if(difference < 0) return false;
if(difference <= 60) return "seconden geleden";
if(difference < 3600) return parseInt(difference/60)+" minuten geleden";
if(difference <= 1.5*3600) return "1 uur geleden";
if(difference < 23.5*3600) return Math.round(difference/3600)+" uren geleden";
if(difference < 1.5*24*3600) return "1 dag geleden";

var dateArr = pastTime.split(' ');
return dateArr[4].replace(/\:\d+$/,'')+' '+dateArr[2]+' '+dateArr[1]+(dateArr[3]!=curDate.getFullYear()?' '+dateArr[3]:'');
};

Philip M
11-01-2012, 01:36 PM
var dateArr = pastTime.split(' ');
var x = dateArr[0];
var emonth = ['January','February','March','April','May','June','July','August','September','October','November',' December'];
var dmonth = ["januari", "februari", "maart", "april", "mei", "juni", "juli", "augustus","september", "oktober","november","december"];
for(var i = 0; i<emonth.length; i++) {
if (x == emonth[i]) {x = dmonth[i]}
dateArr[0] = x;
}
alert (dateArr[0]); // for testing

var displaydate = dateArr[1] + " " + dateArr[0] + " " + dateArr[2];
alert (displaydate);




He could have done one of three things - he didn't do either. Commentator ITV4



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum