You just have to use it with the global namespace!

Instead of

*$d = new DateTime();*

use

*$d = new \DateTime();* //please note the initial '\', which means we're
using a class from the global namespace :)

Marco Pivetta
@Ocramius <http://twitter.com/Ocramius>
http://marco-pivetta.com



On 20 May 2011 11:46, Géometricus <christopheb...@gmail.com> wrote:

> Hi,
>
> I aimed to use a simple php DateTime object within a controller but
> I've
> got the following error :
> Fatal Error : Class .....\....Bundle\Controller\DateTime not found
> in .....
>
> The code ... as simple as :
>
>     $d = new DateTime();
>     die($date->format("Y-m-d H:i:s"));
>
> is working on a simple php page of course.
>
> Symfony Version : 2, Beta1
> php version : 5.3.5
>
> Is it a bug ?
> Have you an Idea of how i could fix this problem ?
>
> Thanks,
>
> --
> If you want to report a vulnerability issue on symfony, please send it to
> security at symfony-project.com
>
> You received this message because you are subscribed to the Google
> Groups "symfony users" group.
> To post to this group, send email to symfony-users@googlegroups.com
> To unsubscribe from this group, send email to
> symfony-users+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/symfony-users?hl=en
>

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to