ActiveDen

PHP Date problems :(

7339 posts
  • Attended a Community Meetup
  • Community Moderator
  • Has been a member for 5-6 years
  • United Kingdom
  • Contributed a Tutorial to a Tuts+ Site
  • Won a Competition
  • Contributed a Blog Post
  • Beta Tester
  • Bought between 50 and 99 items
+4 more
MSFX moderator says

I’m using Zend-AMF to connect from Flash to PHP .

I’m ripping my hair out over the simplest thing :(

The following works perfectly when echo’d in php

$thedate = date("d-m") . "-20" . date("y") . date(" H:i", time());

It should output: 01-10-2009 11:55 (or similiar).

However, when I try wrapping it up in a function within a PHP class:

public function getDate()
{
    $thedate = date("d-m") . "-20" . date("y") . date(" H:i", time());
    return $thedate;
}

and call that function using ZendAMF I get an error indicating there is an error in my PHP class :(

Error #2044: Unhandled NetStatusEvent:. level=error, code=NetConnection.Call.BadVersion

Ive tried simplifying it down to:

public function getDate()
{
    $thedate = date("d");
    return $thedate;
}

but it still gives the error :( anyone have any ideas? :(

edit: love the new code (pre) blocks :)

1389 posts
  • Beta Tester
  • Bought between 10 and 49 items
  • Exclusive Author
  • Grew a moustache for the Envato Movember competition
  • Has been a member for 4-5 years
  • Microlancer Beta Tester
  • Referred between 10 and 49 users
+3 more
Pdesignx says

i think you have something wrong with your AS code… NetConnection.Call.BadVersion

may be about the amf version? i dunno… and i really suggest AMFPHP .. that rocks!

7339 posts
  • Attended a Community Meetup
  • Community Moderator
  • Has been a member for 5-6 years
  • United Kingdom
  • Contributed a Tutorial to a Tuts+ Site
  • Won a Competition
  • Contributed a Blog Post
  • Beta Tester
  • Bought between 50 and 99 items
+4 more
MSFX moderator says
i think you have something wrong with your AS code… NetConnection.Call.BadVersion may be about the amf version? i dunno… and i really suggest AMFPHP .. that rocks!

i’m using ZendAMF which is the version of AMF -PHP supported by adobe…

My AS code is fine because if I change the php function to:

public function getDate()
{
    $thedate = "01-10-2009: 12:25";
    return $thedate;
}

then it works and returns the value to flash as it should do so there is something going on with the date function :(

7339 posts
  • Attended a Community Meetup
  • Community Moderator
  • Has been a member for 5-6 years
  • United Kingdom
  • Contributed a Tutorial to a Tuts+ Site
  • Won a Competition
  • Contributed a Blog Post
  • Beta Tester
  • Bought between 50 and 99 items
+4 more
MSFX moderator says

ARGHHHHHHHHHHHHHH !

:( :x
1844 posts
  • Elite Author
  • Sold between 100 000 and 250 000 dollars
  • Author had a File in an Envato Bundle
  • Has been a member for 4-5 years
  • Author had a Free File of the Month
  • Won a Competition
  • Bought between 10 and 49 items
+4 more
bitfade says

ARGHHHHHHHHHHHHHH !

:( :x
try to set date 2nd optional parameter:
$thedate = date("d",time());
7339 posts
  • Attended a Community Meetup
  • Community Moderator
  • Has been a member for 5-6 years
  • United Kingdom
  • Contributed a Tutorial to a Tuts+ Site
  • Won a Competition
  • Contributed a Blog Post
  • Beta Tester
  • Bought between 50 and 99 items
+4 more
MSFX moderator says

ARGHHHHHHHHHHHHHH !

:( :x
try to set date 2nd optional parameter:
$thedate = date("d",time());

yeah still wont work :(

works on its own, its when used within the ZendAMF it breaks :(

1844 posts
  • Elite Author
  • Sold between 100 000 and 250 000 dollars
  • Author had a File in an Envato Bundle
  • Has been a member for 4-5 years
  • Author had a Free File of the Month
  • Won a Competition
  • Bought between 10 and 49 items
+4 more
bitfade says

works at all if you swap “date” with other functions ? like “strtoupper”

535 posts
  • Beta Tester
  • Has been a member for 4-5 years
  • Sold between 1 000 and 5 000 dollars
dimumurray says
I don’t know a lick of PHP but have you tried returning the string as is like in the following snippet:
public function getDate(){
    return (date("d-m") . "-20" . date("y") . date(" H:i", time()));
}
7339 posts
  • Attended a Community Meetup
  • Community Moderator
  • Has been a member for 5-6 years
  • United Kingdom
  • Contributed a Tutorial to a Tuts+ Site
  • Won a Competition
  • Contributed a Blog Post
  • Beta Tester
  • Bought between 50 and 99 items
+4 more
MSFX moderator says
works at all if you swap “date” with other functions ? like “strtoupper”

yeah, works with all string functions, its just the date that wont work :?:(

7339 posts
  • Attended a Community Meetup
  • Community Moderator
  • Has been a member for 5-6 years
  • United Kingdom
  • Contributed a Tutorial to a Tuts+ Site
  • Won a Competition
  • Contributed a Blog Post
  • Beta Tester
  • Bought between 50 and 99 items
+4 more
MSFX moderator says
I don’t know a lick of PHP but have you tried returning the string as is like in the following snippet:
public function getDate(){
    return (date("d-m") . "-20" . date("y") . date(" H:i", time()));
}

yeah that wont work either, seems any date call just breaks it :(

by
by
by
by
by