Flash 日期格式化Mobile Flex项目
我有一个移动应用程序,可以获取rss提要。rss提要上的日期显示为2011年10月28日星期五格林威治标准时间17:30:00,我希望它以cst时间标准dd/mm/yyyy和时间的短日期呈现。下面是我的应用程序的代码。这是第一次使用AdobeFlashBuilderFlash 日期格式化Mobile Flex项目,flash,apache-flex,mobile,adobe,Flash,Apache Flex,Mobile,Adobe,我有一个移动应用程序,可以获取rss提要。rss提要上的日期显示为2011年10月28日星期五格林威治标准时间17:30:00,我希望它以cst时间标准dd/mm/yyyy和时间的短日期呈现。下面是我的应用程序的代码。这是第一次使用AdobeFlashBuilder <?xml version="1.0" encoding="utf-8"?> <s:View xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="li
<?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>
为了得到约会的机会,我想我会做这样的事情,不可否认,这可能不是最好的方式
//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);
}
我想这会管用的。你必须在我设置快捷方式的地方进行更改,但我认为你可以找到答案
另外,我不确定我是否确实为字符串设置了正确的位置,因此您可能需要更改这些位置 我对此不知所措,我试图将代码添加到其中,但它到处都是错误。请记住,我是Flex mobile新手,需要帮助。我也有一个相同提要的列表设置,但仍然存在日期问题。我试过两种方法。