Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Are you having fun yet?


devel / comp.lang.php / Re: UTC to local time, allowing for US daylight savings time.

SubjectAuthor
* UTC to local time, allowing for US daylight savings time.bill
+* Re: UTC to local time, allowing for US daylight savings time.Lew Pitcher
|`* Re: UTC to local time, allowing for US daylight savings time.bill
| `* Re: UTC to local time, allowing for US daylight savings time.Lew Pitcher
|  `- Re: UTC to local time, allowing for US daylight savings time.bill
`* Re: UTC to local time, allowing for US daylight savings time.J.O. Aho
 `- Re: UTC to local time, allowing for US daylight savings time.bill

1
UTC to local time, allowing for US daylight savings time.

<t0niui$a4e$1@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=454&group=comp.lang.php#454

  copy link   Newsgroups: comp.lang.php
Path: i2pn2.org!i2pn.org!aioe.org!0Rru9CdXXiQq2r8Rbz8z8A.user.46.165.242.75.POSTED!not-for-mail
From: william@TechServSys.com (bill)
Newsgroups: comp.lang.php
Subject: UTC to local time, allowing for US daylight savings time.
Date: Mon, 14 Mar 2022 10:20:01 -0400
Organization: Aioe.org NNTP Server
Message-ID: <t0niui$a4e$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="10382"; posting-host="0Rru9CdXXiQq2r8Rbz8z8A.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.7.0
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: en-US
 by: bill - Mon, 14 Mar 2022 14:20 UTC

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?

Thanks in advance,

-bill

Re: UTC to local time, allowing for US daylight savings time.

<t0nlt0$fd8$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=455&group=comp.lang.php#455

  copy link   Newsgroups: comp.lang.php
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: lew.pitcher@digitalfreehold.ca (Lew Pitcher)
Newsgroups: comp.lang.php
Subject: Re: UTC to local time, allowing for US daylight savings time.
Date: Mon, 14 Mar 2022 15:10:24 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 28
Message-ID: <t0nlt0$fd8$1@dont-email.me>
References: <t0niui$a4e$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 14 Mar 2022 15:10:24 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="e3847d7101edb1cc7fd7049c13c288be";
logging-data="15784"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+cmHVC9/ho3gnqGcn0tjShTI7lD6Po0p0="
User-Agent: Pan/0.139 (Sexual Chocolate; GIT bf56508
git://git.gnome.org/pan2)
Cancel-Lock: sha1:w/y6WnvP2g1HjX1TInNJ1W+09jA=
 by: Lew Pitcher - Mon, 14 Mar 2022 15:10 UTC

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

--
Lew Pitcher
"In Skills, We Trust"

Re: UTC to local time, allowing for US daylight savings time.

<j994msF7u12U1@mid.individual.net>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=456&group=comp.lang.php#456

  copy link   Newsgroups: comp.lang.php
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: user@example.net (J.O. Aho)
Newsgroups: comp.lang.php
Subject: Re: UTC to local time, allowing for US daylight savings time.
Date: Mon, 14 Mar 2022 16:18:52 +0100
Lines: 26
Message-ID: <j994msF7u12U1@mid.individual.net>
References: <t0niui$a4e$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: individual.net ieu1PKL8iOtbxkB7/IYt3gmEBPY/jVhDZD0SHsLbtf+ClVu5Xw
Cancel-Lock: sha1:+NTLLBTrwzBVBbvBNTK6V5VuXc4=
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.6.1
Content-Language: en-US-large
In-Reply-To: <t0niui$a4e$1@gioia.aioe.org>
 by: J.O. Aho - Mon, 14 Mar 2022 15:18 UTC

On 14/03/2022 15.20, 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?

something like this?

date_default_timezone_set('UTC');
utc_datetime = '2008-08-03 12:35:23';
$datetime = new DateTime(utc_datetime);
$ny_time = new DateTimeZone('America/New_York');
$datetime->setTimezone($ny_time);
echo $datetime->format('Y-m-d H:i:s');

You have also possibility to use javascript in the UI, then you could
quite simply get to the users local time without having a config.

--

//Aho

Re: UTC to local time, allowing for US daylight savings time.

<t0qff5$1qd$1@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=457&group=comp.lang.php#457

  copy link   Newsgroups: comp.lang.php
Path: i2pn2.org!i2pn.org!aioe.org!0Rru9CdXXiQq2r8Rbz8z8A.user.46.165.242.75.POSTED!not-for-mail
From: william@TechServSys.com (bill)
Newsgroups: comp.lang.php
Subject: Re: UTC to local time, allowing for US daylight savings time.
Date: Tue, 15 Mar 2022 12:39:01 -0400
Organization: Aioe.org NNTP Server
Message-ID: <t0qff5$1qd$1@gioia.aioe.org>
References: <t0niui$a4e$1@gioia.aioe.org> <t0nlt0$fd8$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="1869"; posting-host="0Rru9CdXXiQq2r8Rbz8z8A.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.7.0
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: en-US
 by: bill - Tue, 15 Mar 2022 16:39 UTC

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

Re: UTC to local time, allowing for US daylight savings time.

<t0qfsv$9bc$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=458&group=comp.lang.php#458

  copy link   Newsgroups: comp.lang.php
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: lew.pitcher@digitalfreehold.ca (Lew Pitcher)
Newsgroups: comp.lang.php
Subject: Re: UTC to local time, allowing for US daylight savings time.
Date: Tue, 15 Mar 2022 16:46:23 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 38
Message-ID: <t0qfsv$9bc$1@dont-email.me>
References: <t0niui$a4e$1@gioia.aioe.org> <t0nlt0$fd8$1@dont-email.me>
<t0qff5$1qd$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 15 Mar 2022 16:46:23 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="28721bdbbb8de034b1143f854ecdfaec";
logging-data="9580"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/ksyEzbw72kBw2NIetL10mkJUJcW6bYkk="
User-Agent: Pan/0.139 (Sexual Chocolate; GIT bf56508
git://git.gnome.org/pan2)
Cancel-Lock: sha1:X9PTQSWvMdkf9rHYj5poY1tGD1M=
 by: Lew Pitcher - Tue, 15 Mar 2022 16:46 UTC

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"

Re: UTC to local time, allowing for US daylight savings time.

<t0sga7$1efu$1@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=459&group=comp.lang.php#459

  copy link   Newsgroups: comp.lang.php
Path: i2pn2.org!i2pn.org!aioe.org!0Rru9CdXXiQq2r8Rbz8z8A.user.46.165.242.75.POSTED!not-for-mail
From: william@TechServSys.com (bill)
Newsgroups: comp.lang.php
Subject: Re: UTC to local time, allowing for US daylight savings time.
Date: Wed, 16 Mar 2022 07:05:43 -0400
Organization: Aioe.org NNTP Server
Message-ID: <t0sga7$1efu$1@gioia.aioe.org>
References: <t0niui$a4e$1@gioia.aioe.org> <j994msF7u12U1@mid.individual.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="47614"; posting-host="0Rru9CdXXiQq2r8Rbz8z8A.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.7.0
Content-Language: en-US
X-Notice: Filtered by postfilter v. 0.9.2
 by: bill - Wed, 16 Mar 2022 11:05 UTC

On 3/14/2022 11:18 AM, J.O. Aho wrote:
> On 14/03/2022 15.20, 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?
>
> something like this?
>
> date_default_timezone_set('UTC');
> utc_datetime = '2008-08-03 12:35:23';
> $datetime = new DateTime(utc_datetime);
> $ny_time = new DateTimeZone('America/New_York');
> $datetime->setTimezone($ny_time);
> echo $datetime->format('Y-m-d H:i:s');
>
> You have also possibility to use javascript in the UI, then you
> could quite simply get to the users local time without having a
> config.
>
>
That works. Thank you very much.
-bill

Re: UTC to local time, allowing for US daylight savings time.

<t0sgb9$1efu$2@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=460&group=comp.lang.php#460

  copy link   Newsgroups: comp.lang.php
Path: i2pn2.org!i2pn.org!aioe.org!0Rru9CdXXiQq2r8Rbz8z8A.user.46.165.242.75.POSTED!not-for-mail
From: william@TechServSys.com (bill)
Newsgroups: comp.lang.php
Subject: Re: UTC to local time, allowing for US daylight savings time.
Date: Wed, 16 Mar 2022 07:06:17 -0400
Organization: Aioe.org NNTP Server
Message-ID: <t0sgb9$1efu$2@gioia.aioe.org>
References: <t0niui$a4e$1@gioia.aioe.org> <t0nlt0$fd8$1@dont-email.me>
<t0qff5$1qd$1@gioia.aioe.org> <t0qfsv$9bc$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="47614"; posting-host="0Rru9CdXXiQq2r8Rbz8z8A.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.7.0
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: en-US
 by: bill - Wed, 16 Mar 2022 11:06 UTC

On 3/15/2022 12:46 PM, Lew Pitcher wrote:
> 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.
>

I did that, thanks.
-bill

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor