53
rated 0 times
[
60]
[
7]
/ answers: 1 / hits: 25090
/ 13 Years ago, wed, august 24, 2011, 12:00:00
How to pass argument of Date to another function? My code:
var myDate = new Date(data.GetOPCResult.DateTime.match(/d+/)[0] * 1);
var datlabel = document.getElementById(ct);
datlabel.innerHTML = GetTime(myDate);
And GetTime function code:
function GetTime(DateTime) {
var month = (DateTime.getMonth() < 10) ? 0 + (DateTime.getMonth() + 1) : (DateTime.getMonth() + 1);
var day = (DateTime.getDate() < 10) ? 0 + DateTime.getMonth() : DateTime.getMonth();
var hour = (DateTime.getHours() < 10) ? 0 + DateTime.getHours() : DateTime.getHours();
var minute = (DateTime.getMinutes() < 10) ? 0 + DateTime.getMinutes() : DateTime.getMinutes();
var second = (DateTime.getSeconds() < 10) ? 0 + DateTime.getSeconds() : DateTime.getSeconds();
return DateTime.getDate() + . + month + . + DateTime.getFullYear() + + hour + : + minute + : + second;
}
More From » javascript