
function advancedDate(gmtDateStr, short) {
    if (short === undefined) {
	short = false;
    }

    var date = new Date();

    // Get date 
    var todayDateTs = Date.parse(date.toDateString());
    var yesterdayDateTs = todayDateTs - 24 * 60 * 60 * 1000;

    // Given time in GMT
    date.setTime(Date.parse(gmtDateStr));

    // Given date in Local, Timestamp
    var givenDateTs = Date.parse(date.toDateString());

    if (givenDateTs == todayDateTs) {
	// Today, show date only
    } else if (givenDateTs == yesterdayDateTs) {
    	document.write("Hier, ");
    } else {
    	var givenDate = new Date();
    	givenDate.setTime(givenDateTs);
    	
    	var day = givenDate.getDate();
    	var month = givenDate.getMonth();
    	
    	if (day < 10) {
    		day = "0" + day;
    	}
    	if (month < 10) {
    		month = "0" + month;
    	}
    	document.write(day + "/" + month + " ");

	if (short) {
	    return;
	}
    }

    document.write(date.toTimeString().substring(0, 5));
}
