今天我做的项目中需要把时间给拆分了,形式为:yyyy-MM-DD HH mm,

下面是我的代码实现:

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
               xmlns:s="library://ns.adobe.com/flex/spark"
               xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"
               width="100%" height="100%"
               >
    <fx:Declarations>
        <mx:DateFormatter id="dateFormat" formatString="YYYY-MM-DD JJ:NN:SS"/>
    </fx:Declarations>
    <fx:Script>
        <![CDATA[
        import mx.formatters.*;
        [Bindable]
        private var time:Date=new Date();  
        private function TestDateTimeToString():void
        {
        var fr:DateFormatter=new DateFormatter();
        var fs:DateFormatter=new DateFormatter();
        var ft:DateFormatter=new DateFormatter();
        fr.formatString="YYYY-MM-DD JJ:NN:SS";
        fs.formatString="JJ";
        ft.formatString="NN";
        myDate.text=fr.format(time);
        hour.text=fs.format(time);
        minutes.text=ft.format(time);
        }
        ]]>   
    </fx:Script>
    <mx:Panel width="100%" height="100%">
        <mx:Label id="currentTimeText" text="当前日期:"/>
        <mx:Label id="currentTime" text="{dateFormat.format(time)}"/>
        <mx:Button label="转换日期" click="TestDateTimeToString()"/>
        <mx:Label id="myDate" text="时间还没有被转换" />
        <mx:Label id="hour" text="时间还没有被转换"/>
        <mx:Label id="minutes" text="时间还没有被转换"/>
    </mx:Panel>
</s:Application>
效果如下:

最新文章

  1. Sentiment Analysis resources
  2. Scrapy001-框架初窥
  3. live555 直播arm-linux视频
  4. MVC中的CSRF解决方案
  5. Network 分类: POJ 图论 2015-07-27 17:18 17人阅读 评论(0) 收藏
  6. shell学习总结之自定义函数
  7. careercup-递归和动态规划 9.4
  8. Js regular exprission
  9. &quot;git rm&quot; 和 &quot;rm&quot; 的区别
  10. Unity 获取服务器时间 HTTP请求方式
  11. 【转】DHCP协议详解
  12. 剑指Offer_4_二维数组中的查找
  13. HTTP相关:TCP/IP、DNS
  14. mysql 在visual studio中的配置
  15. numpy的数组常用运算练习
  16. Bootstrap-3-Typeahead
  17. mongodb创建用户(转发)
  18. leetcode(js)算法之696计数二进制串
  19. ionic 前端接收到后台推送来的消息后,显示在手机的通知栏上
  20. VS2015 无法启动 IIS服务器

热门文章

  1. Mrc.EOF
  2. MVC - 云服务器部署
  3. Java获取http和https协议返回的json数据
  4. ASP.NET连接数据库配置文件
  5. Python求解登楼梯问题(京东2016笔试题)
  6. 在IntelliJ IDEA 13中配置OpenCV的Java开发环境
  7. 如何通过注解Bean类来封装SQL插入语句
  8. c++编程思想(四)--对象和隐藏(感觉书上有误)
  9. 多源最短路径---Floyd-Warshall算法
  10. C#Redis 主从复制