Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #18889
| From | Lew Pitcher <lew.pitcher@digitalfreehold.ca> |
|---|---|
| Newsgroups | comp.lang.php |
| Subject | Re: UTC to local time, allowing for US daylight savings time. |
| Date | 2022-03-15 16:46 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <t0qfsv$9bc$1@dont-email.me> (permalink) |
| References | <t0niui$a4e$1@gioia.aioe.org> <t0nlt0$fd8$1@dont-email.me> <t0qff5$1qd$1@gioia.aioe.org> |
On Tue, 15 Mar 2022 12:39:01 -0400, bill wrote: > 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 Then, J Aho's advice is what you want. See his response upthread. -- Lew Pitcher "In Skills, We Trust"
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