Adobe Dreamweaver Forums



Last 10 THreads :         linking to a database using xml (Last Post : Dooza - Replies : 17 - Views : 18 )           »          dreamweaver v. movable type? (Last Post : anniemosie - Replies : 0 - Views : 1 )           »          SWF slide show does not play (Last Post : hammerkp - Replies : 0 - Views : 1 )           »          Nav Bar images missing in generated help (Last Post : eoprigjernt - Replies : 4 - Views : 5 )           »          FlashVars help (Last Post : kglad - Replies : 1 - Views : 2 )           »          Adobe Flex 3 with AIR Certification Exam is Now Out !!! (Last Post : glen08 - Replies : 1 - Views : 2 )           »          Login Problem (Last Post : Jatrix - Replies : 13 - Views : 15 )           »          Disabling menu bars in a browser window (Last Post : jhabrix - Replies : 0 - Views : 1 )           »          Basing new project on old project (Last Post : RoboWizard - Replies : 1 - Views : 2 )           »          Why is this not working!!! (Last Post : Boxing Boom - Replies : 1 - Views : 2 )           »         


Home Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
User Info Statistics
Go Back   Adobe Dreamweaver Forums > Other Macromedia/Adobe Products > Flex
 
Tags: , , ,



Reply
  #1 (permalink)  
Old 06-17-2008, 02:55 AM
kyalong
 
Posts: n/a
Diggs:
Default How to convert a date string to a Date object

hi,

I'm puzzled by a DATE question:

I retrieved a date from my database ,and converted the sqlResult into a XML.
so the date become a string in my xml.

when I fill the xml data to the DataGrid , I want to use the DateFormatter to
format the string of date.
It's failed .Because the method only can format date object .

I searched in the help doc and searched in google.I haven't got a way how to
covert a date string to the date object.

my date string from the XML like this:[h]Fri Jun 13 00:00:00 GMT+0800 2008[/h]

I try to use String as Date to covert it .but the output is Null.

I have no way to settle the matter.

wait for your help thx!



Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 06-17-2008, 02:55 AM
levancho
 
Posts: n/a
Diggs:
Default Re: How to convert a date string to a Date object

DateField has static method that oes that :

stringToDate () method
public static function stringToDate(valueString:String,
inputFormat:String)ate

Parses a String object that contains a date, and returns a Date object
corresponding to the String. The inputFormat argument contains the pattern in
which the valueString String is formatted. It can contain "M","D","Y", and
delimiter and punctuation characters. The function does not check for the
validity of the Date object. If the value of the date, month, or year is NaN,
this method returns null.
Parameters
valueString:String ? Date value to format.

inputFormat:String ? String defining the date format.

Returns
Date ? The formatted date as a Date object.

Example

var dobate = DateField.stringToDate("06/30/2005", "MM/DD/YYYY");

Reply With Quote
  #3 (permalink)  
Old 06-17-2008, 02:55 AM
Paul
 
Posts: n/a
Diggs:
Default Re: How to convert a date string to a Date object

On Jun 16, 5:46 pm, "kyalong" <webforumsu...@macromedia.com> wrote:
> hi,
>
> I'm puzzled by aDATEquestion:
>
> I retrieved adatefrom my database ,and converted the sqlResult into a XML.
> so thedatebecome astringin my xml.
>
> when I fill the xml data to the DataGrid , I want to use the DateFormatter to
> format thestringofdate.
> It's failed .Because the method only can formatdateobject.
>
> I searched in the help doc and searched in google.I haven't got a way how to
> covert adatestringto thedateobject.
>
> mydatestringfrom the XML like this:[h]Fri Jun 13 00:00:00 GMT+0800 2008[/h]
>
> I try to useStringasDateto covert it .but the output is Null.
>
> I have no way to settle the matter.
>
> wait for your help thx!


Well looks like you're trying to convert a RFC822 date format. If you
look at the Flex3 docs for the Date Object (the constructor), it'll
give you some examples of how to convert your string to a Date
Object. Here's how it would look like:

var myDateate = new Date("Fri Jun 13 00:00:00 GMT+0800 2008");

Also, if you're dealing with other formats like the W3C date format,
you can use the open-source library as3corelib, and there's a class
called com.adobe.utils.DateUtil, which should do the trick.
Reply With Quote


  #4 (permalink)  
Old 06-17-2008, 03:46 AM
kyalong
 
Posts: n/a
Diggs:
Default Re: How to convert a date string to a Date object

thx for your reply,levancho .

var dobate = DateField.stringToDate("Fri Jun 13 00:00:00 GMT+0800 2008
", "?");

But what's format of the string"Fri Jun 13 00:00:00 GMT+0800 2008" ?

Reply With Quote
  #5 (permalink)  
Old 06-17-2008, 09:45 AM
Kaotic101
 
Posts: n/a
Diggs:
Default Re: How to convert a date string to a Date object

For the structure of your date I have most of it here but I don't think there
is a formatter for GMT. Example as follows. However I think you could make it
much easier on yourself by formatting the date to a much easier format on the
SQL side first before it even hits Flex.

var dobate = DateField.stringToDate("Fri Jun 13 00:00:00 GMT+0800 2008",
"EEE MMM DD HH:NN:SS ???+HHNN YYYY");


SQL

--------------------------------------------------------------------------------
-------------------------------
SELECT
date_format(fld_dob, '%m/%d/%Y') AS dob
FROM
table

Reply With Quote
  #6 (permalink)  
Old 06-17-2008, 09:45 AM
Kaotic101
 
Posts: n/a
Diggs:
Default Re: How to convert a date string to a Date object

For the structure of your date I have most of it here but I don't think there
is a formatter for GMT. Example as follows. However I think you could make it
much easier on yourself by formatting the date to a much easier format on the
SQL side first before it even hits Flex.

var dobate = DateField.stringToDate("Fri Jun 13 00:00:00 GMT+0800 2008",
"EEE MMM DD HH:NN:SS ???+HHNN YYYY");


SQL

--------------------------------------------------------------------------------
-------------------------------
SELECT
date_format(fld_dob, '%m/%d/%Y') AS dob
FROM
table

Reply With Quote


  #7 (permalink)  
Old 06-17-2008, 09:45 AM
kyalong
 
Posts: n/a
Diggs:
Default Re: How to convert a date string to a Date object

Thx!

I had settled the matter.
data.transDate is a String like:Fri Jun 13 00:00:00 GMT+0800 2008

------------------------------------------------------
var milliseconds:Number = Date.parse(data.transDate);

var mydateate = new Date(milliseconds);

var mydateStr:String = DateField.dateToString(mydate,"YYYY-MM-DD")

Reply With Quote
  #8 (permalink)  
Old 08-19-2008, 07:56 AM
Zolvivaccitty Zolvivaccitty is offline
Junior Member
 
Join Date: Aug 2008
Posts: 1
Diggs: 0
Default Demya.com - Publish Custom Posts on Millions of Forums Worldwide

Publish Your Custom Message On Millions of Forums Worldwide

We can publsih your custom message on forums, blogs and message systems worldwide. Unlike Google Ads that are static, we actually penetrate into online exisiting forums to post your messages. You can promote your website, product and/or services. In fact, this post was published by automated means!

Main Promotional Services:
** Posts will appear just as this post appears
** All custom posts will appear to have been published by unique users
** Exploit your commericial potential by posting on forums relative to your business
** Ability to Randomize & Rotate Posts for Increased Uniqueness
** Send Mass PM messages to forum members worldwide with your custom message

Please Note - I am offering a service, not software. Please refer to my online step-by-step movie demonstration listed below proving how I can post your website, product or services on millions of websites worldwide.

This will increase your web traffic, increase your potential sales, and also increase the amount of 3rd party websites that will link back to your site - which convinces major search engines of the popularity of your website.

Many of the posts are published on PR6, PR7 and PR8 Google ranked websites.

Online Video Demonstration
Please watch this 5 minute video demonstrating how your custom post will be published
Click Here to Watch Automated Forum Posting Demonstration

Contact me If Your Interested
ICQ: 162456288
Gmail Chat: sharepro at gmail.com
More Info: Demya.com

Btw - If you want to purchase pre-made established and promoted niche mp3 music, video, game and other social websites, please refer to Demya.com
Reply With Quote
  #9 (permalink)  
Old 08-22-2008, 01:24 AM
Alisasunny Alisasunny is offline
Junior Member
 
Join Date: Aug 2008
Posts: 1
Diggs: 0
Default Very Good

It is pleasant to me here.
Index of /
brokerage,bulk email marketing campaign
corporate finance,rendleman-bartter model
OpenDNS
index,electronic
swift,swift
logistics,absolute poverty
logistics,absolute poverty
logistics,absolute poverty
Reply With Quote


  #10 (permalink)  
Old 08-26-2008, 07:45 AM
JennyDi JennyDi is offline
Junior Member
 
Join Date: Aug 2008
Posts: 1
Diggs: 0
Default My business

..my business.

marketing plan
index,electronic
swift,swift
logistics,absolute poverty
Index of /
brokerage,bulk email marketing campaign
corporate finance,rendleman-bartter model
logistics,absolute poverty
logistics,absolute poverty
ps marketing plan,slope system
Jenny
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



© Camley Interactive (camley.info) 2008 - all logos and images are copywrite their respective owners.
Proud member of the Camley Interactive Network
All times are GMT. The time now is 05:32 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.
Cheap Car Insurance - Compare Motor Insurance
Endsleigh Car Insurance Natwest Car Insurance
More Than Car Insurance Norwich Union Car Insurance
Prudential Car Insurance Zurich Car Insurance
Inactive Reminders By Mished.co.uk