Search code examples
phpdatetimeormtimezoneredbean

RedBeanPHP - R::isoDateTime() - How to set timezone?


There is a convenience function in RedBeanPHP ORM for ceating dates.

$time = R::isoDateTime();

How can I set a time zone?

The default function does not return the time of the machine on which RB is running on.


Solution

  • It appears from reading the source code, that R::isoDateTime() is just a convenience method. It simply calls the PHP time() function, then formats the result as a string using the date function.

    I didn't test it, but in theory - the date_default_timezone_set function should work. For example:

    date_default_timezone_set('America/Los_Angeles');