CodeCanyon

PHP Date problems :(

3409 posts
  • Has been a member for 4-5 years
  • Contributed a Tutorial to a Tuts+ Site
  • Netherlands
  • Community Moderator
  • Microlancer Beta Tester
  • Sold between 10 000 and 50 000 dollars
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Exclusive Author
+4 more
Joost moderator says

Odd.. are you able to use the date() function outside your PHP class, but in a regular php document on your server?

7474 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 can use the class and call the function using solely php and it works as it should, its when I try using it through the framework that it breaks :(

Will try and make a zip in a bit..

3 posts
  • Has been a member for 3-4 years
elbjoern says

hi MSFX , i am haveing the same odd problem over here. have you solved yours? cheer, elbjoern

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

may be your pc does not allow php to gather your system time and date… i am not sure if there is such a feature :P but in case vista has some really annoying restrictions that could be the problem…

3 posts
  • Has been a member for 3-4 years
elbjoern says

i found a solution. instead of date i use zend_date.

require_once 'Zend/Date.php';
$datetime = Zend_Date::now()->toString('YYYY-MM-dd HH:mm:ss');

that’s all. cheers, elbjoern

@Pdesignx: i don’t have a stupid windows-pc ;)

7474 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 found a solution. instead of date i use zend_date.
require_once 'Zend/Date.php';
$datetime = Zend_Date::now()->toString('YYYY-MM-dd HH:mm:ss');

that’s all. cheers, elbjoern

@Pdesignx: i don’t have a stupid windows-pc ;)

if this works, your a star! Will give it a shot in the morning :)

PDesign, using XP :):P

3 posts
  • Has been a member for 3-4 years
elbjoern says

do it!

1 post
  • Has been a member for 1-2 years
myonlypost says

I created an account just to post this, since I’ve just spent about four hours on this issue. Hope someone reads it! Zend_Date is great, but it requires a bunch of crap to get it to work the same way as php’s date(). Also, while date() allows you to escape characters in your format string (if, for example, you wanted to literally output ‘GMT’ in your string) Zend_Date does not support this, even if you set its format strings to behave like php formats with Zend_Date::setOptions(array(‘format_type’ => ‘php’)).

To get php’s date() method up and running, just make sure you have a default timezone set! you can do this with the date_default_timezone_set() method, or by setting it in your ini file.

by
by
by
by
by