This email is to be read subject to the disclaimer below.
For anyone else grappling with this problem - I couldn't find a ready made
solution to this so unfortunately I've had to write a simple date parsing
function.
Very basic at the moment - but will expand as needed:
// Parse a string and return a date object.
// If invalid data passed then current date is returned.
function parseDate(string:String,format:String):Date{
var myDate:Date = new Date();
var day:Number;
var month:Number;
var year:Number;
var aDate:Array;
switch(format){
case "dd/mm/yy":
aDate = string.split('/');
if(aDate.length >= 3) { //We have enough to create a valid date
year = parseInt(aDate[2],10);
if(year < 30) year += 2000; //If below 30 assume 2000's
else if(year <100) year += 1900; //or below 100 assume
1900's
month = parseInt(aDate[1],10)-1; //Month is done from 0
to 11
day = parseInt(aDate[0],10);
myDate.setFullYear(year,month,day);
}
break;
}
return myDate;
}
Does anyone know of a good flash function library (similar to cflib.org) or
projects developing good function libraries?
Cheers,
Mark
--------------------
NOTICE - This communication contains information which is confidential and
the copyright of Ernst & Young or a third party.
If you are not the intended recipient of this communication please delete
and destroy all copies and telephone Ernst & Young on 1800 655 717
immediately. If you are the intended recipient of this communication you
should not copy, disclose or distribute this communication without the
authority of Ernst & Young.
Any views expressed in this Communication are those of the individual
sender, except where the sender specifically states them to be the views of
Ernst & Young.
Except as required at law, Ernst & Young does not represent, warrant and/or
guarantee that the integrity of this communication has been maintained nor
that the communication is free of errors, virus, interception or
interference.
Liability limited by the Accountants Scheme, approved under the
Professional Standards Act 1994 (NSW)
--------------------
---
You are currently subscribed to fugli as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004