I want to show current datetime in my webpage which will show current counter for datetime. Means it will increase time for each second like c# timer.
I used following code for this.
<label id = "TimerValue" ></label>
var test = new Date($.now());
var timer = $.timer(function () {
var ttt = moment(++test).format(Tag);
$("#TimerValue").html(ttt);
});
timer.set({ time: 1000, autostart: true });
this code increases value. But Format is "1419227503752";
This value increasing Each Seconds.
May be this value is Correct but now i want to change this value to my defined Datetime formats.
Some of the formats are as below:
yyyy-MM-dd HH:mm:ss
yyyy-MM-dd HH:mm
yyyy/MM/dd HH:mm:ss
yyyy/MM/dd HH:mm
yyyy年MM月dd日 HH時mm分ss秒
yyyy年MM月dd日 HH時mm分
yyyy年MM月dd日
HH時mm分ss秒
HH:mm:ss
HH時mm分
HH:mm
HH時
timer i have using plug in Where moment is plugin for formatting date time String.
I also refer this but no Success.
Can anybody help me out this?