Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #18888
| From | bill <william@TechServSys.com> |
|---|---|
| Newsgroups | comp.lang.php |
| Subject | Re: UTC to local time, allowing for US daylight savings time. |
| Date | 2022-03-15 12:39 -0400 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <t0qff5$1qd$1@gioia.aioe.org> (permalink) |
| References | <t0niui$a4e$1@gioia.aioe.org> <t0nlt0$fd8$1@dont-email.me> |
On 3/14/2022 11:10 AM, Lew Pitcher wrote: > On Mon, 14 Mar 2022 10:20:01 -0400, bill wrote: > >> I have a UTC time and I need to display it as local time (always >> US Eastern time). >> >> I could check to see if we are now in standard or daylight time >> and then add the appropriate number of hours, but it seems there >> should be an easier way with php automagically doing the proper >> conversion. >> >> Any suggestions? > > One possibility (which may be overkill for you; you decide) would > be to change the "date.timezone" value in php.ini to name EST5EDT > rather than the default UTC > [Date] > ; Defines the default timezone used by the date functions > ; http://php.net/date.timezone > date.timezone = EST5EDT ; override UTC default > > From there, you can use the php date functions, and they will > reflect EST5EDT dates and times > > HTH > I wasn't clear enough: I have a variable (from an ical string) containing the appointment date/time as UTC. In order to display this I need to convert it to local (12 hr) time. Thanks bill
Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
UTC to local time, allowing for US daylight savings time. bill <william@TechServSys.com> - 2022-03-14 10:20 -0400
Re: UTC to local time, allowing for US daylight savings time. Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2022-03-14 15:10 +0000
Re: UTC to local time, allowing for US daylight savings time. bill <william@TechServSys.com> - 2022-03-15 12:39 -0400
Re: UTC to local time, allowing for US daylight savings time. Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2022-03-15 16:46 +0000
Re: UTC to local time, allowing for US daylight savings time. bill <william@TechServSys.com> - 2022-03-16 07:06 -0400
Re: UTC to local time, allowing for US daylight savings time. "J.O. Aho" <user@example.net> - 2022-03-14 16:18 +0100
Re: UTC to local time, allowing for US daylight savings time. bill <william@TechServSys.com> - 2022-03-16 07:05 -0400
csiph-web