首页 > AIR/RIA > ActionScript和mxml中日期格式化——DateFormatter

ActionScript和mxml中日期格式化——DateFormatter

跟Java很相似。都是使用一个格式化类来进行格式化:

第一步:var dateFormatter:DateFormatter=new DateFormatter();//生成格式化对象

第二步:dateFormatter.formatString=”YYYY-MM-DD JJ:NN:SS”;//设定格式

第三步:dateFormatter.format(time);//执行格式化

需要特别注意的是:time必须是Date类型的,否则格式化出来的时间是800(这是因为我们的时区是东八区),没事干的朋友可以试试,哈哈!

欢迎转载,转载请注明来源和作者,谢谢!

评论暂缺

  • (Required)
  • (Required, will not be published)

Verify Code   If you cannot see the CheckCode image,please refresh the page again!