RedBeanPHP - R :: isoDateTime () - How to set the time zone?

RedBeanPHP ORM has a convenience feature for terminating dates.

$time = R::isoDateTime();

How to set the time zone?

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

+1
source share
2 answers

It seems that the source code for that R::isoDateTime()- it's just a convenient method. It simply calls the PHP function time(), then formats the result as a string using the function date.

I did not test it, but theoretically - the function date_default_timezone_setshould work. For instance:

date_default_timezone_set('America/Los_Angeles');
+1
source

, R::isoDateTime() - .

RedBean, (3.x, 4.x), :

@date( 'Y-m-d H:i:s', $time )`

i.e.: . : 2017-09-05 18:49:16.


MySQL:

, datetime - , R::isoDateTime() .


Postgres:

Postgres , Postgres ( PHP!). , , RedBean, , , .

:

  • Postgres: SHOW timezone;.
  • Postgres (): ALTER ROLE myuser SET timezone = 'Europe/Paris';.
  • Postgres, . , , . , UTC, , . , R::isoDateTime() - @date( 'c' ), .: 2017-09-05T18: 49: 16 + 02: 00.

, , , Postgres UTC, / timestamp without a time zone (AKA timestamptz) timezone. : 2017-09-05T18: 49: 16 + 02: 00, ​​/, 2017-09-05T16: 49: 16 + 00: 00, UTC ( .)

( RedBean, . , -.)

0

All Articles