Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 10-22-2003, 11:34 PM   #1
Registered User
Join Date: Oct 2003
Posts: 21
Default how to turn date string into date object?

Hey folx. I have a date string like this "10/15/2003".
How do I turn that into a date object flash can use?
Here is the code I have to show you what I mean:
ActionScript Code:
var s_date = "10/15/2003"; //i want to get s_date into format you see below var myDate = new Date(2003,10,15);
As you can see above, I have 10/15/2003 in a string and sure I could write some string manipulation script to parse and grab each of the elements using the "/" as a delimiter but is there not a more elegant way? A function FlashMX already has for turning that into the date format of 2003,10,15?
If so, please tell me and show me the syntax.
ScotterMonk is offline   Reply With Quote
Old 10-23-2003, 02:23 AM   #2
Super Moderator
CyanBlue's Avatar
Join Date: Jan 2002
Location: Centreville, VA
Posts: 26,666

This is the similar one I was able to find...
CyanBlue / Jason Je / Macromedia Certified Flash Developer & Designer

Do NOT PM, Email or Call me... Your question belongs right in this forum...
CyanBlue is offline   Reply With Quote
Old 10-23-2003, 02:49 AM   #3
Banned by AS.org Staff
Join Date: Mar 2002
Posts: 10,533

oldnewbie is offline   Reply With Quote
Old 10-23-2003, 03:57 AM   #4
village halfwit
pixelwit's Avatar
Join Date: Jul 2001
Location: USA, PA
Posts: 3,330

ActionScript Code:
var s_date = "10/15/2003"; function dateStringToObject(dateString){     var date_ar = dateString.split("/");     return new Date(date_ar[2], date_ar[0]-1, date_ar[1]); } var myDateObj = dateStringToObject(s_date); trace("myDateObj = "+myDateObj);
Doesn't look all that inelegant to me.

There are no answers, only choices.
pixelwit is offline   Reply With Quote

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

All times are GMT. The time now is 04:01 PM.

Follow actionscriptorg on Twitter


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.