2

I have a very strange problem about datetime. The datetime stored in the database shown as valid in the form but it's wrong when normally printed.

Here is my column data:

delivery_date = datetime type
value = 2015-11-06 13:00:00 (Y-m-d H:i:s)

enter image description here

Here is my form data:

$builder->add('delivery_date', 'date', ['label' => 'Teslim', 'widget' => "single_text"]);

Output:

enter image description here

Print codes:

<tr>
    <td>Sipariş Tarihi</td>
    <td>{{ order.createdAt|date("d F Y, l, H:i")|format_date("dd MMMM y, EEEE, HH:mm") }}</td>
</tr>
<tr>
    <td>Teslim Tarihi</td>
    <td>{{ order.deliveryDate|date("d F Y, l")|format_date("dd MMMM y, EEEE") }}</td>
</tr>
<tr>
    <td>Son Güncelleme</td>
    <td>{{ order.updatedAt|date("d F Y, l, H:i")|format_date("dd MMMM y, EEEE, HH:mm") }}</td>
</tr>
<tr>
    <td>Son Hareket</td>
    <td>{{ order.movements.last.createdAt|date("d F Y, l, H:i")|format_date("dd MMMM y, EEEE, HH:mm") }}</td>
</tr>

Output: enter image description here

Second row named "teslim tarihi" is wrong. In the form it's true because day is 06, but printed day is 05. Other rows has same column type "datetime". But there is no problem for now.

By the way;

  • i have intl extension already enabled
  • php version is old stable 5.5.30
  • Timezone is Europe/Istanbul.
  • Using SonataIntlBundle for Symfony.
  • Os: Centos, date command is valid (output now: Sun Oct 25 15:35:52 EEST 2015).

What causes that difference?

Canser Yanbakan
  • 3,780
  • 3
  • 39
  • 65

1 Answers1

0

Chaining these two filters is nonsense. There is no point in formatting a date in one way, just to directly convert it to a different format afterwards. If it's about printing month names etc. you can use the localizeddate filter from the Intl Extension.

LorenzSchaef
  • 1,523
  • 10
  • 16