I have a script that prints the current date and time in JavaScript, but the DATE
is allways wrong. Here is the code:
var currentdate = new Date();
var datetime = "Last Sync: " + currentdate.getDay() + "/"+currentdate.getMonth()
+ "/" + currentdate.getFullYear() + " @ "
+ currentdate.getHours() + ":"
+ currentdate.getMinutes() + ":" + currentdate.getSeconds();
It should print 18/04/2012 15:07:33
and prints 3/3/2012 15:07:33
Any help? Thanks
Its simple and superb
please find the below fiddler for the example
http://jsfiddle.net/4zVxp/483/
Check this out may be it will work for you
This should do the trick:
This little code is easy and works everywhere.
there is room to design
I think i am very late to share my answer, but i think it will be worth.
console.log(__getCurrentDateTime('h:mi:ss ampm')); //return in 1:5:30 PM