Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /home/chrob6/acleveraddress.com/wp/wp-content/themes/acleveraddress/header.php:4) in /home/chrob6/acleveraddress.com/wp/wp-content/plugins/mycaptcha/MyCaptcha.php on line 41

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/chrob6/acleveraddress.com/wp/wp-content/themes/acleveraddress/header.php:4) in /home/chrob6/acleveraddress.com/wp/wp-content/plugins/mycaptcha/MyCaptcha.php on line 41

PHP Date in AS3

July 28, 2008 – 10:37 am

I had to do some date formatting for a project recently, and realised I missed the PHP Date function, so I recreated it in Actionscript 3. While I was doing it I noticed it’s been done a few times before, but there tend to be quite a few of the options missed out, or mistakes made, especially when it comes to the ISO stuff. The only function I couldn’t replicate properly was the Timezone identifier (e) as AS simply doesn’t have access to that information, so it could only be faked.

The example shows lovely slashes being used in the string but in the actual code you’ll have to escape (double) them or use a dollar symbol. Usage: DateUtils.date(‘c’, new Date(2008, 01, 01)); The date defaults to the (client side) date if it’s null.

Source here.

Post a Comment

Enter this code