Advertisement
nciric

Globalization API sample

Nov 17th, 2011
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var locales = new Globalization.LocaleList(['en', 'de-DE-u-co-phonebk']);
  2.  
  3. var dtf = new Globalization.DateTimeFormat(locales,
  4.   {year: 'long', month: 'long', day: 'long',
  5.    hour: 'numeric', minute: '2-digit', second: '2-digit'});
  6.  
  7. // dtf object can be inspected by looking at dtf.resolvedOptions property
  8. // so one can check if he got requested features (locale, option fields...)
  9.  
  10. for (var i = 0; i < 50; i++) {
  11.   var result = dtf.format(new Date());
  12.   // Use result in a Forum page with 50 users.
  13. }
  14.  
  15. // One time use, with default options.
  16. var single = new Globalization.DateTimeFormat(locales).format(new Date());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement