Groups | Search | Server Info | Keyboard shortcuts | Login | Register
Groups > comp.lang.php > #18692
| From | "J.O. Aho" <user@example.net> |
|---|---|
| Newsgroups | comp.lang.php, alt.comp.lang.php, alt.php |
| Subject | Re: Newbie needs recommendation for fast learning a little php. |
| Date | 2021-06-29 21:01 +0200 |
| Message-ID | <ik1915Fh66nU1@mid.individual.net> (permalink) |
| References | <rdbmdghp8532b2sgknb9iqv6a0i6vlom8p@4ax.com> |
Cross-posted to 3 groups.
On 29/06/2021 16.30, Not_even_a_newbie@example.net wrote:
> I mostly need to do a specific thing, get a file to
> display its last modified date and time inside itself.
>
> I used to use ssi for this, but I moved to a new Web host and they
> seem to have their server time zone set as the only time zone I can
> display, and they are far away from me, so in ssi I get a date and
> time for a file modification time that's many hours off.
I'm assuming you got the PHP code to work to show the date (even if it's
the wrong timezone for you).
If you have stored the date in a variable $lastmodified then you could
use the following code to adjust it:
$date = date_create($lastmodified, timezone_open('Pacific/Nauru'));
echo date_format($date, 'Y-m-d H:i:sP');
Just use a valid timezone name to replace the Pacific/Nauru. Keep in
mind that the time may look off for other users who do not live in the
timezone you want to display.
For more information about datetime and timezone check the following
page at php.net:
https://www.php.net/manual/en/datetime.settimezone.php
--
//Aho
Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar
Newbie needs recommendation for fast learning a little php. Not_even_a_newbie@example.net - 2021-06-29 10:30 -0400
Re: Newbie needs recommendation for fast learning a little php. "J.O. Aho" <user@example.net> - 2021-06-29 21:01 +0200
Re: Newbie needs recommendation for fast learning a little php. Not_even_a_newbie@example.net - 2021-06-30 05:58 -0400
Re: Newbie needs recommendation for fast learning a little php. Not_even_a_newbie@example.net - 2021-06-30 08:08 -0400
Re: Newbie needs recommendation for fast learning a little php. Arno Welzel <usenet@arnowelzel.de> - 2021-06-30 15:09 +0200
Re: Newbie needs recommendation for fast learning a little php. Not_even_a_newbie@example.net - 2021-06-30 13:46 -0400
Re: Newbie needs recommendation for fast learning a little php. Arno Welzel <usenet@arnowelzel.de> - 2021-07-01 10:49 +0200
Re: Newbie needs recommendation for fast learning a little php. "J.O. Aho" <user@example.net> - 2021-06-30 16:24 +0200
Re: Newbie needs recommendation for fast learning a little php. Not_even_a_newbie@example.net - 2021-06-30 13:49 -0400
Re: Newbie needs recommendation for fast learning a little php. "J.O. Aho" <user@example.net> - 2021-06-30 22:23 +0200
Re: Newbie needs recommendation for fast learning a little php. Not_even_a_newbie@example.net - 2021-07-01 00:49 -0400
Re: Newbie needs recommendation for fast learning a little php. "J.O. Aho" <user@example.net> - 2021-07-01 08:03 +0200
Re: Newbie needs recommendation for fast learning a little php. Arno Welzel <usenet@arnowelzel.de> - 2021-07-01 12:35 +0200
Re: Newbie needs recommendation for fast learning a little php. Not_even_a_newbie@example.net - 2021-07-02 18:21 -0400
Re: Newbie needs recommendation for fast learning a little php. Not_even_a_newbie@example.net - 2021-07-02 19:36 -0400
Re: Newbie needs recommendation for fast learning a little php. John-Paul Stewart <jpstewart@personalprojects.net> - 2021-07-02 20:01 -0400
Re: Newbie needs recommendation for fast learning a little php. Not_even_a_newbie@example.net - 2021-07-03 00:08 -0400
Re: Newbie needs recommendation for fast learning a little php. Arno Welzel <usenet@arnowelzel.de> - 2021-07-03 15:40 +0200
Re: Newbie needs recommendation for fast learning a little php. Not_even_a_newbie@example.net - 2021-07-03 14:36 -0400
Re: Newbie needs recommendation for fast learning a little php. rcpj@panix.com (Pierre Jelenc) - 2021-07-01 21:36 +0000
Re: Newbie needs recommendation for fast learning a little php. Not_even_a_newbie@example.net - 2021-07-02 18:49 -0400
Re: Newbie needs recommendation for fast learning a little php. rcpj@panix.com (Pierre Jelenc) - 2021-07-02 23:02 +0000
Re: Newbie needs recommendation for fast learning a little php. Arno Welzel <usenet@arnowelzel.de> - 2021-07-01 12:29 +0200
Re: Newbie needs recommendation for fast learning a little php. Ray_Net <Ray_Net@picarre.be.invalid> - 2021-06-30 23:03 +0200
Re: Newbie needs recommendation for fast learning a little php. Not_even_a_newbie@example.net - 2021-07-02 18:07 -0400
Re:Newbie needs recommendation for fast learning a little php. Blue Hat <blue_hat@hackershaven.com.jm> - 2021-08-08 13:43 -0500
csiph-web