B
B
Bestolkovy2016-08-21 13:12:49
PHP
Bestolkovy, 2016-08-21 13:12:49

How to get timezone in datetime?

Good afternoon!
I have a function that returns the creation date of a post. for the datetime="" attribute, but it incorrectly shows the time zone, like this: 2016-08-16T17:30:17+00:00, but it should be like this: 2016-08-16T17:30:17+07:00.
The function itself: datetime="<?php the_time( 'c' ); ?>".
How to change it so that the time zone is displayed correctly (except for manually registering, of course).

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2016-08-21
@initrd0

As an option like this:
In general, it's easier to specify the correct time zone in apache, or in the final file:

<?php
date_default_timezone_set('America/Los_Angeles');
?>

php.net/manual/en/function.date-default-timezone-s...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question