views:

100

answers:

1

hello everyone i 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" Please help!

A: 

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
thank brianpeiris verymuch
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