View Full Version : Converting String into Date

01-23-2006, 04:21 PM
Does anyone have any idea how to take a string that has a date in it and convert it into time with ActionScript. Here is an example of the string for today: "January 23, 2006 5:11:00 AM PST". This will change everyday and is being passed into my flash movie as a parameter but I donít know how to get Flash to recognize it.

Thanks in advance if anyone can help.

01-23-2006, 05:33 PM
hy, can you tell a bit more 'bout your problem. Why do you need to get the date from outside flash?what are you going to do with that date inside flash? how are you going to treat it?

01-23-2006, 06:13 PM
The reason the data is coming outside of flash is because it needs to be a timestamp from the server and not from the local PC. This is the only way that the developer knows how to give me the timestamp from the server is by passing the time "January 23, 2006 5:11:00 AM PST" through the parameters with JavaScript. I didnít know if there is some easy way for flash to tell that this is a date.


03-04-2006, 02:58 PM
I too am looking for an answer to this.

If I take my string, and simply assign it to a variable of type Date, all date functions return undefined. For example:

var myDate:Date;
myDate = "January 23, 2006 5:11:00 AM PST";

The trace will show "undefined". In other words, flash does NOT correctly convert a string which contains a valid date into a date object.

So, the question again is, how do you TRULY convert a string into a date object?