I am using AjaxPro to retreive database, the date field return Sat Apr 3 00:00:00 UTC+0700 1982 i want to format it like "dd/mm/yyyy".
Asked
Active
Viewed 304 times
1 Answers
2
Assuming you are getting a DateTime value from the server, you can do something similar to this:
Visit http://www.ajaxpro.info/Examples/DataType/default.aspx and run the following code in Firebug.
var result = AJAXDemo.Examples.DataType.Demo.GetDateTime(new Date()).value;
var year = result.getFullYear();
var month = result.getMonth() + 1;
var day = result.getDate();
var formattedDate = [day, month, year].join('/');
console.log(formattedDate);

brianpeiris
- 10,735
- 1
- 31
- 44
-
You're welcome thienthai. Please remember to vote for my answer and/or mark it as accepted if you think it answered your question. Cheers. – brianpeiris May 01 '09 at 11:40