Twig icon indicating copy to clipboard operation
Twig copied to clipboard

hour getting

Open IreneArgolloDelgadillo opened this issue 10 years ago • 3 comments

Hi, im the value of startTime in the bd is: bdfechainicio

but this is rendering: fechaindex and i get the time and date in this way:

{{ "now"|date("d/m/Y H:i")}} {{ testA.startTime|date("H:i") }}

IreneArgolloDelgadillo avatar Aug 15 '16 16:08 IreneArgolloDelgadillo

That's probably a timezone issue. Anyway, you should use Stackoverflow for your questions as issues are only used for bugs. Thanks.

fabpot avatar Aug 15 '16 17:08 fabpot

I report it here, because I was used the time zone: { { testA.startTime | date ( "H: i", " America / La_Paz ")} } It does not work as expected because it return the same value :/ , not supposed that It should return the same value of data base regardless of the time zone because it is recovering from db? :/ anyway, for this case, I was forced to use the date_modify function , so: { { testA.startTime | date_modify ( "+ 5 Hour " ) | date ( "H: i ")} }

IreneArgolloDelgadillo avatar Aug 15 '16 18:08 IreneArgolloDelgadillo

@IreneArgolloDelgadillo If your database server has a different timezone this causes a conflict, and PostgreSQL actually has it's own configuration for timezones If I recall correctly.

Say your database server is configured with America/Chicago, and your PHP configuration with America/La_Paz, then the date PHP received from database is not in the same timezone.

Then when tell PHP to convert the timezone to America/La_Paz, it will fail because the timezone is already in the that one.

sstok avatar Aug 16 '16 07:08 sstok