I have datetime string in the following style: "Tue Feb 1 2005 10:05:34 PM"
How do I convert this to a Date value? I've gone so far as experimenting with the following tools, but can't seem to get it to work....
var dtStr : String = "Tue Feb 1 2005 10:05:34 PM";
var fmtStr : String = "EEE MMM D YYYY L:N:S A";
var myDate : Date = DateField.stringToDate( dtStr, fmtStr );
==================
FOLLOWUP: I responded to my own post answering the above question... but then realized I could edit my original posting. Duh! Sooooo, I'll repeat it here:
Ok, I figured it out. Being a "flex-friendly" date structure, I simply did this...
var dtStr : String = "Tue Feb 1 2005 10:05:34 PM";
var myDate : Date = new Date( dtStr );
Now that I've gone this far, I'd like to change the question to address my next obstacle...
The 'myDate' value is being used in a DataGrid filterfunction to display only those rows between dates that are specified in two DateField controls: dateFrom and dateTo. The code in my filterFunction is as follows...
var leftLimitPassed : Boolean = dateFrom.selectedDate==nul
l
|| myDate >= dateFrom.selectedDate;
var rightLimitPassed : Boolean = dateTo.selectedDate==null
|| myDate <= dateTo.selectedDate;
return leftLimitPassed && rightLimitPassed;
It works just fine, but with a minor 'fencepost' issue: If both dateFrom and dateTo are equal to, say, "2008-02-16", then data I know exists on that date is not being displayed. So I think I need to set the dateFrom's time to "00:00:00" and dateTo's time to "23:59:59".
How is that done?
Start Free Trial