Answer the question
In order to leave comments, you need to log in
How to convert time to seconds in DateControl?
Goodnight.
On the site, in the form I use DateControl .
I figured out a little with the plugin, but two questions arose.
The first question:
I need to save the date and time in unixtime format in separate fields of the table.
In the plugin settings I specified the following:
<?php
'datecontrol' => [
'class' => '\kartik\datecontrol\Module',
// остальные настройки удалил, чтобы не растягивать)))
'saveSettings' => [
Module::FORMAT_DATE => 'php:U',
Module::FORMAT_TIME => 'php:U'
],
]
?>
Answer the question
In order to leave comments, you need to log in
Keeping the time and date separate is weird, since data in unix format already contains the time. Why another field?
And what confuses you is: 12/13/1901 @ 23:17:11 MMT (GTM +02:31)
In general, it is difficult to store time without a date in this format. Since this is the number of seconds since midnight (00:00:00 UTC) on January 1, 1970. Accordingly, whatever value you specify, it contains the value of both the date and time.
The DateControl should not be able to do this, unlike the widget you use to do this. And in the widget settings, there is probably such an opportunity.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question