P
P
Pavel2014-11-05 16:58:39
PHP
Pavel, 2014-11-05 16:58:39

Date issue in Drupal 7?

Push in the right direction... The situation is this, there is a custom form on Drupal 7, after submitting it writes the results to the database. There are no problems with recording, but I can’t understand why the date and time of filling are not correctly formed when fetching from the database.
Date and time of filling out the form:

<?php
$сreated = REQUEST_TIME;   //результат 1415194288, что соответствует 2014-11-05 16:31:28 
?>

but when I try to get the filling time later - it shows me an hour more ...
I get this:
<?php
$dateCreated = format_date($task->created, 'custom', 'Y-m-d H:i:s O');
//результат 2014-11-05 17:31:28 
?>

what am i doing wrong???

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexander, 2014-11-05
@misantron

The problem of switching to winter time from October 26.

D
Dm4k, 2014-11-05
@Dm4k

Probably the case is in the wrong time zone on the server, or the database, or in the application settings, or anywhere of the above.
habrahabr.ru/post/240937
Try to make a clean php script on the server and display the time, then from the database, and so you can cut off the culprit;)

I
Ivan Gontarenko, 2014-11-05
@dez-fafara

make
it possible in mysql the date is not correct. I had a very similar problem, after changing the time 26/09

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question