Hi,
This is simple code but, i got it after so much time..
var d = new Date();
// Get today date in this format Fri Jun 29 2012 10:57:53 GMT+0530 (IST).
var curr_date = d.getDate();
// Get the only date from today date.
var curr_month = d.getMonth();
// Get the only month from today date.
curr_month++;
// Increase month by 1. becz, u got less one.
var curr_year = d.getFullYear();
// Get the only year from today date.
// You can get also time, second, minute like this.
var second =d.getSeconds();
var minutes = d.getMinutes();
var hour = d.getHours();
var milliSeconds = d.getMilliseconds();
// And also join it in date.
// Now join it in any format.
var today = curr_year + "-" + curr_month + "-" + curr_date;
// like this return 2012-5-12
var today = curr_year + "." + curr_month + "." + curr_date;
// like this return 2012.5.12
var today = curr_month + "/" + curr_year + "/" + curr_date;
// like this return 5/2012/12
--
Thank You
Nelson Desai
0 comments:
Post a Comment