215 Posts
cubist
6 years ago
4
Topic

I was trying to capture NOW in PDT in the Code Before Store type field, but the trf_submit_datetime field still records UTC after I check the database record. Hmm... or is there a better way? Thx

$utc = new DateTimeZone('UTC');
$pdt = new DateTimeZone('America/Los_Angeles');
$now_utc = new DateTime('now', $utc);
$now_utc->setTimeZone($pdt); 
$fields['trf_submit_datetime']->value = $now_utc->format('Y-m-d H:i:s');
Get a VIP membership
215 Posts
cubist
6 years ago
0
Level 1

I also considered doing a search / list template override, but this seems it's NOT possible -- true?

4229 Posts
Kadministrator
6 years ago
2
Level 1

Value set in beforestore should be also the one the is recorded. Did you by any chance use it on the calendar field? If this is the case I would suggest that you use hidden text field instead.

215 Posts
cubist
6 years ago
1
Level 2

Yes, it is the calendar field and it is hidden. What's strange it works in the template, but the actual recorded date/time in the database is NOT correct. Very perplexing.

Do you know where Joomla gets it's UTC time from? Is it php.ini? is it from the control panel? in our case it's Plesk. 

It seems Seblod should just add an OFFSET parameter to the calendar plugin. 

4229 Posts
Kadministrator
6 years ago
0
Level 3

If you want to store exact value you need to use text field, calendar field does transformations, value in database is always save in UTC (it is converted from input value to UTC and back when it is displayed using server timezone and user timezone set in Joomla).

Get a VIP membership