javascript toLocaleString Function

toLocaleString() function formats a number based on the locale environment.

var nm = 12345678;
nm.toLocaleString(); //12,345,678, in USA
nm.toLocaleString(); //12 345 678, in France
nm.toLocaleString(); //12345678, in China

toLocaleString() can be used to convert the time into local format.
var nm = new Date();
nm.toLocaleString(); //2/28/2014, 10:36:31 PM, in USA
nm.toLocaleString(); //2014/2/28, 22:36:31, in India

endmemo.com © 2017  Terms of Use | Home