The javascript countdown code I am using requires me to use this format: "year, month - 1, day, hour, minute, second". I have the following code, which works, but I'm wondering if there's a simpler method of getting it to work (one with less lines, one that might be quicker?)
$year = date('Y',$date);
$month = date('n',$date);
$day = date('j',$date);
$hour = date('g',$date);
$minute = date('i',$date);
$second = date('s',$date);
$js .= "var newYear = new Date();
newYear = new Date(".$year.", ".$month." - 1, ".$day.", ".$hour.", ".$minute.", ".$second.");
$('#timer').countdown({
until: newYear,
layout: '{hn} h {mn} m {sn} s'
});";
$date, which has presumably been calculated elsewhere, into an appropriate JS value.datefunction six times and then concocting the results is unnecessary, to do it all with onedatefunction call:date("Y, n, y, g, i, s", $date).