【问题标题】:Date Formating Mobile Flex Project日期格式移动 Flex 项目
【发布时间】:2011-10-28 16:05:58
【问题描述】:

我有一个获取 RSS 源的移动应用。 rss 提要上的日期显示格林威治标准时间 2011 年 10 月 28 日星期五 17:30:00,我希望将其呈现为 cst 时间标准 dd/mm/yyyy 和时间的短日期。我的应用程序的代码如下。任何帮助都会很棒这是第一次使用 Adob​​e Flash Builder。

<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
        xmlns:s="library://ns.adobe.com/flex/spark"
        xmlns:ns1="*"
        backgroundColor="#74171E" title="Mediacom 2 / Paulbunyan 32"
        viewActivate="refresh()">

    <fx:Script>
        <![CDATA[
            protected function getData():void
            {
                getDataResult.token = iCTVChannel232.getData();
            }
            public function refresh(): void {
                getData();
            } 
        ]]>


    </fx:Script>

    <fx:Declarations>
        <s:CallResponder id="getDataResult"/>
        <ns1:ICTVChannel232 id="iCTVChannel232"/>
    </fx:Declarations>
    <s:DataGrid id="dataGrid" left="10" right="10" top="10" bottom="10">
        <s:columns>
            <s:ArrayList>
                <s:GridColumn dataField="pubDate" width="65" headerText="Date"></s:GridColumn>
                <s:GridColumn dataField="title" headerText="Title"></s:GridColumn>
            </s:ArrayList>
        </s:columns>
        <s:AsyncListView list="{getDataResult.lastResult}"/>

    </s:DataGrid>
    <s:actionContent>
        <s:Button icon="@Embed('/assets/refreshico.png')"
                  click="Object(navigator.activeView).refresh()"/>
    </s:actionContent>

</s:View>

【问题讨论】:

    标签: flash apache-flex mobile adobe


    【解决方案1】:

    为了获得日期,我认为我会做这样的事情(诚然,这可能不是最好的方法!):

    //Making the Strings
    private var getFeed:String = somehowGetRSSFeed();
    
    private var theDateString:String = getMonth() +
                                    "/" + 
                               getDay() + 
                                    "/" +                                  
                               getYear();
    
    //gets the month from the position of 9 and out to three places and make it a number
    public function getMonth()
    {
        switch(getFeed.substr(9, 3).toUpper())
        {
            case "JAN"
            {
                return "01";
            }
            .
            .
            .
            case "DEC"
            {
                return "12";
            }
    
        }
    }
    
    public function getDay()
    {
        return getFeed.substr(5, 2);
    }
    
    public function getYear()
    {
        return getFeed.substr(12, 4);
    }
    

    我认为这会奏效。您必须在我创建快捷方式的地方进行更改,但我认为您可以弄清楚。

    另外,我不确定我是否确实为琴弦放置了正确的位置,因此您可能需要更改这些位置。

    【讨论】:

    • 我对此感到茫然,我试图将代码添加到
    • 我也有相同提要的 LIST 设置,但日期仍有问题。我已经尝试了这两种方法。
    猜你喜欢
    • 2011-10-07
    • 1970-01-01
    • 2012-01-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多