Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #15693 > unrolled thread
| Started by | Derek Turner <frderek@suremail.je> |
|---|---|
| First post | 2015-10-06 12:59 +0000 |
| Last post | 2015-10-06 11:18 -0400 |
| Articles | 4 — 4 participants |
Back to article view | Back to comp.lang.php
strtotime peculiarities Derek Turner <frderek@suremail.je> - 2015-10-06 12:59 +0000
Re: strtotime peculiarities Erwin Moller <erwinmollerusenet@xs4all.nl> - 2015-10-06 16:23 +0200
Re: strtotime peculiarities Jordan Doyle <jordan@doyle.wf> - 2015-10-08 01:00 +0000
Re: strtotime peculiarities Jerry Stuckle <jstucklex@attglobal.net> - 2015-10-06 11:18 -0400
| From | Derek Turner <frderek@suremail.je> |
|---|---|
| Date | 2015-10-06 12:59 +0000 |
| Subject | strtotime peculiarities |
| Message-ID | <d7hutdFt2bbU1@mid.individual.net> |
<code>
echo date ("D j M Y H:i",strtotime("third Monday of February 14:00"))
</code>
echoes:
Mon 16 Feb 2015 00:54 (when run at 13.54 UTC+1)
so it seems to correctly identify and echo the date but is giving some
sort of relative time.
Is there a way of getting to echo the desired
Mon 16 Feb 2015 14:00?
[toc] | [next] | [standalone]
| From | Erwin Moller <erwinmollerusenet@xs4all.nl> |
|---|---|
| Date | 2015-10-06 16:23 +0200 |
| Message-ID | <5613d930$0$23723$e4fe514c@news.xs4all.nl> |
| In reply to | #15693 |
On 10/6/2015 2:59 PM, Derek Turner wrote:
> echo date ("D j M Y H:i",strtotime("third Monday of February 14:00"))
Try adding a timezone to PHP for the time, like UTC:
echo date ("D j M Y H:i",strtotime("third Monday of February 14:00 UTC"))
https://en.wikipedia.org/wiki/Coordinated_Universal_Time
You might also have a look at:
http://php.net/manual/en/function.date-default-timezone-get.php
ALso, check if the conversion worked.
If it returns false, you will end up with the (very suspect) date:
"Thu 1 Jan 1970 01:00"
When I see 1 Jan 1970, I get knowI am screwing up somewhere. ;-)
Regards,
Erwin Moller
--
"That which can be asserted without evidence, can be dismissed without
evidence."
-- Christopher Hitchens
[toc] | [prev] | [next] | [standalone]
| From | Jordan Doyle <jordan@doyle.wf> |
|---|---|
| Date | 2015-10-08 01:00 +0000 |
| Message-ID | <6fjRx.48502$D45.36515@fx46.am4> |
| In reply to | #15694 |
On Tue, 06 Oct 2015 16:23:00 +0200, Erwin Moller wrote:
> On 10/6/2015 2:59 PM, Derek Turner wrote:
>> echo date ("D j M Y H:i",strtotime("third Monday of February 14:00"))
>
> Try adding a timezone to PHP for the time, like UTC:
>
> echo date ("D j M Y H:i",strtotime("third Monday of February 14:00
> UTC"))
>
> https://en.wikipedia.org/wiki/Coordinated_Universal_Time
>
> You might also have a look at:
> http://php.net/manual/en/function.date-default-timezone-get.php
>
> ALso, check if the conversion worked.
> If it returns false, you will end up with the (very suspect) date:
> "Thu 1 Jan 1970 01:00"
>
> When I see 1 Jan 1970, I get knowI am screwing up somewhere. ;-)
>
> Regards,
> Erwin Moller
It might be worth adding a default timezone either in your ini file:
date.timezone=Europe/London
or at the top of your script using
date_default_timezone_set("Europe/London")
https://secure.php.net/manual/en/function.date-default-timezone-set.php
Regards,
Jordan Doyle
[toc] | [prev] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2015-10-06 11:18 -0400 |
| Message-ID | <mv0ojh$5hn$1@dont-email.me> |
| In reply to | #15693 |
On 10/6/2015 8:59 AM, Derek Turner wrote:
> <code>
> echo date ("D j M Y H:i",strtotime("third Monday of February 14:00"))
> </code>
>
> echoes:
>
> Mon 16 Feb 2015 00:54 (when run at 13.54 UTC+1)
>
> so it seems to correctly identify and echo the date but is giving some
> sort of relative time.
>
> Is there a way of getting to echo the desired
>
> Mon 16 Feb 2015 14:00?
>
Derek,
This might be a duplicate of bug 66257 - see
https://bugs.php.net/bug.php?id=66257
It looks quite similar, but nothing's been done on it since last April.
Maybe a little goosing from your part could get it worked on.
--
==================
Remove the "x" from my email address
Jerry Stuckle
jstucklex@attglobal.net
==================
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.php
csiph-web