Strange result for strptime with %p

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Strange result for strptime with %p

R help mailing list-2
Dear members... are these results normal ?

For the first one, no problem. I expected this:

 > strptime("05/01/18 01:00:00 AM", format = ("%m/%d/%y %I:%M:%S %p"),
tz="Asia/Jayapura")
[1] "2018-05-01 01:00:00 WIT"

For this one, it is ok also:

 > strptime("05/01/18 01:00:00 AM", format = ("%m/%d/%y %I:%M:%S %p"),
tz="Asia/Jayapura")-1
[1] "2018-05-01 00:59:59 WIT"

But how to explain this ???

 > strptime("05/01/18 00:59:59 AM", format = ("%m/%d/%y %I:%M:%S %p"),
tz="Asia/Jayapura")
[1] NA

Thanks for your advices
Marc
______________________

R 3.5.1 on MacOS 10.14

 > version
                _
platform       x86_64-apple-darwin15.6.0
arch           x86_64
os             darwin15.6.0
system         x86_64, darwin15.6.0
status
major          3
minor          5.1
year           2018
month          07
day            02
svn rev        74947
language       R
version.string R version 3.5.1 (2018-07-02)
nickname       Feather Spray

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Strange result for strptime with %p

PIKAL Petr
Hi

Maybe it is connected to
%I
Hours as decimal number (01–12).

Your input has hour as 00

Cheers
Petr

> -----Original Message-----
> From: R-help <[hidden email]> On Behalf Of Marc Girondot via
> R-help
> Sent: Tuesday, October 2, 2018 3:30 PM
> To: R-help Mailing List <[hidden email]>
> Subject: [R] Strange result for strptime with %p
>
> Dear members... are these results normal ?
>
> For the first one, no problem. I expected this:
>
>  > strptime("05/01/18 01:00:00 AM", format = ("%m/%d/%y %I:%M:%S %p"),
> tz="Asia/Jayapura")
> [1] "2018-05-01 01:00:00 WIT"
>
> For this one, it is ok also:
>
>  > strptime("05/01/18 01:00:00 AM", format = ("%m/%d/%y %I:%M:%S %p"),
> tz="Asia/Jayapura")-1
> [1] "2018-05-01 00:59:59 WIT"
>
> But how to explain this ???
>
>  > strptime("05/01/18 00:59:59 AM", format = ("%m/%d/%y %I:%M:%S %p"),
> tz="Asia/Jayapura")
> [1] NA
>
> Thanks for your advices
> Marc
> ______________________
>
> R 3.5.1 on MacOS 10.14
>
>  > version
>                 _
> platform       x86_64-apple-darwin15.6.0
> arch           x86_64
> os             darwin15.6.0
> system         x86_64, darwin15.6.0
> status
> major          3
> minor          5.1
> year           2018
> month          07
> day            02
> svn rev        74947
> language       R
> version.string R version 3.5.1 (2018-07-02)
> nickname       Feather Spray
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
Osobní údaje: Informace o zpracování a ochraně osobních údajů obchodních partnerů PRECHEZA a.s. jsou zveřejněny na: https://www.precheza.cz/zasady-ochrany-osobnich-udaju/ | Information about processing and protection of business partner’s personal data are available on website: https://www.precheza.cz/en/personal-data-protection-principles/
Důvěrnost: Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a podléhají tomuto právně závaznému prohláąení o vyloučení odpovědnosti: https://www.precheza.cz/01-dovetek/ | This email and any documents attached to it may be confidential and are subject to the legally binding disclaimer: https://www.precheza.cz/en/01-disclaimer/

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Strange result for strptime with %p

Peter Dalgaard-2
Nice catch, Petr:

> strptime("05/01/18 00:59:59 AM", format = ("%m/%d/%y %I:%M:%S %p"), tz="Asia/Jayapura")
[1] NA
> strptime("05/01/18 12:59:59 AM", format = ("%m/%d/%y %I:%M:%S %p"), tz="Asia/Jayapura")
[1] "2018-05-01 00:59:59 WIT"

-pd

> On 2 Oct 2018, at 15:39 , PIKAL Petr <[hidden email]> wrote:
>
> Hi
>
> Maybe it is connected to
> %I
> Hours as decimal number (01–12).
>
> Your input has hour as 00
>
> Cheers
> Petr
>
>> -----Original Message-----
>> From: R-help <[hidden email]> On Behalf Of Marc Girondot via
>> R-help
>> Sent: Tuesday, October 2, 2018 3:30 PM
>> To: R-help Mailing List <[hidden email]>
>> Subject: [R] Strange result for strptime with %p
>>
>> Dear members... are these results normal ?
>>
>> For the first one, no problem. I expected this:
>>
>>> strptime("05/01/18 01:00:00 AM", format = ("%m/%d/%y %I:%M:%S %p"),
>> tz="Asia/Jayapura")
>> [1] "2018-05-01 01:00:00 WIT"
>>
>> For this one, it is ok also:
>>
>>> strptime("05/01/18 01:00:00 AM", format = ("%m/%d/%y %I:%M:%S %p"),
>> tz="Asia/Jayapura")-1
>> [1] "2018-05-01 00:59:59 WIT"
>>
>> But how to explain this ???
>>
>>> strptime("05/01/18 00:59:59 AM", format = ("%m/%d/%y %I:%M:%S %p"),
>> tz="Asia/Jayapura")
>> [1] NA
>>
>> Thanks for your advices
>> Marc
>> ______________________
>>
>> R 3.5.1 on MacOS 10.14
>>
>>> version
>>                _
>> platform       x86_64-apple-darwin15.6.0
>> arch           x86_64
>> os             darwin15.6.0
>> system         x86_64, darwin15.6.0
>> status
>> major          3
>> minor          5.1
>> year           2018
>> month          07
>> day            02
>> svn rev        74947
>> language       R
>> version.string R version 3.5.1 (2018-07-02)
>> nickname       Feather Spray
>>
>> ______________________________________________
>> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
> Osobní údaje: Informace o zpracování a ochraně osobních údajů obchodních partnerů PRECHEZA a.s. jsou zveřejněny na: https://www.precheza.cz/zasady-ochrany-osobnich-udaju/ | Information about processing and protection of business partner’s personal data are available on website: https://www.precheza.cz/en/personal-data-protection-principles/
> Důvěrnost: Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a podléhají tomuto právně závaznému prohláąení o vyloučení odpovědnosti: https://www.precheza.cz/01-dovetek/ | This email and any documents attached to it may be confidential and are subject to the legally binding disclaimer: https://www.precheza.cz/en/01-disclaimer/
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

--
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: [hidden email]  Priv: [hidden email]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Strange result for strptime with %p

PIKAL Petr
Hi

Credit belongs to documentation. I picked it from it.

Cheers
Petr

> -----Original Message-----
> From: peter dalgaard <[hidden email]>
> Sent: Tuesday, October 2, 2018 4:15 PM
> To: PIKAL Petr <[hidden email]>
> Cc: Marc Girondot <[hidden email]>; r-help mailing list <r-help@r-
> project.org>
> Subject: Re: [R] Strange result for strptime with %p
>
> Nice catch, Petr:
>
> > strptime("05/01/18 00:59:59 AM", format = ("%m/%d/%y %I:%M:%S %p"),
> > tz="Asia/Jayapura")
> [1] NA
> > strptime("05/01/18 12:59:59 AM", format = ("%m/%d/%y %I:%M:%S %p"),
> > tz="Asia/Jayapura")
> [1] "2018-05-01 00:59:59 WIT"
>
> -pd
>
> > On 2 Oct 2018, at 15:39 , PIKAL Petr <[hidden email]> wrote:
> >
> > Hi
> >
> > Maybe it is connected to
> > %I
> > Hours as decimal number (01–12).
> >
> > Your input has hour as 00
> >
> > Cheers
> > Petr
> >
> >> -----Original Message-----
> >> From: R-help <[hidden email]> On Behalf Of Marc
> >> Girondot via R-help
> >> Sent: Tuesday, October 2, 2018 3:30 PM
> >> To: R-help Mailing List <[hidden email]>
> >> Subject: [R] Strange result for strptime with %p
> >>
> >> Dear members... are these results normal ?
> >>
> >> For the first one, no problem. I expected this:
> >>
> >>> strptime("05/01/18 01:00:00 AM", format = ("%m/%d/%y %I:%M:%S %p"),
> >> tz="Asia/Jayapura")
> >> [1] "2018-05-01 01:00:00 WIT"
> >>
> >> For this one, it is ok also:
> >>
> >>> strptime("05/01/18 01:00:00 AM", format = ("%m/%d/%y %I:%M:%S %p"),
> >> tz="Asia/Jayapura")-1
> >> [1] "2018-05-01 00:59:59 WIT"
> >>
> >> But how to explain this ???
> >>
> >>> strptime("05/01/18 00:59:59 AM", format = ("%m/%d/%y %I:%M:%S %p"),
> >> tz="Asia/Jayapura")
> >> [1] NA
> >>
> >> Thanks for your advices
> >> Marc
> >> ______________________
> >>
> >> R 3.5.1 on MacOS 10.14
> >>
> >>> version
> >>                _
> >> platform       x86_64-apple-darwin15.6.0
> >> arch           x86_64
> >> os             darwin15.6.0
> >> system         x86_64, darwin15.6.0
> >> status
> >> major          3
> >> minor          5.1
> >> year           2018
> >> month          07
> >> day            02
> >> svn rev        74947
> >> language       R
> >> version.string R version 3.5.1 (2018-07-02)
> >> nickname       Feather Spray
> >>
> >> ______________________________________________
> >> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> >> https://stat.ethz.ch/mailman/listinfo/r-help
> >> PLEASE do read the posting guide
> >> http://www.R-project.org/posting-guide.html
> >> and provide commented, minimal, self-contained, reproducible code.
> > Osobní údaje: Informace o zpracování a ochraně osobních údajů
> > obchodních partnerů PRECHEZA a.s. jsou zveřejněny na:
> > https://www.precheza.cz/zasady-ochrany-osobnich-udaju/ | Information
> > about processing and protection of business partner’s personal data
> > are available on website:
> > https://www.precheza.cz/en/personal-data-protection-principles/
> > Důvěrnost: Tento e-mail a jakékoliv k němu připojené dokumenty jsou
> > důvěrné a podléhají tomuto právně závaznému prohláąení o vyloučení
> > odpovědnosti: https://www.precheza.cz/01-dovetek/ | This email and any
> > documents attached to it may be confidential and are subject to the
> > legally binding disclaimer: https://www.precheza.cz/en/01-disclaimer/
> >
> > ______________________________________________
> > [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> > http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
>
> --
> Peter Dalgaard, Professor,
> Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000
> Frederiksberg, Denmark
> Phone: (+45)38153501
> Office: A 4.23
> Email: [hidden email]  Priv: [hidden email]
>
>
>
>
>
>
>
>

Osobní údaje: Informace o zpracování a ochraně osobních údajů obchodních partnerů PRECHEZA a.s. jsou zveřejněny na: https://www.precheza.cz/zasady-ochrany-osobnich-udaju/ | Information about processing and protection of business partner’s personal data are available on website: https://www.precheza.cz/en/personal-data-protection-principles/
Důvěrnost: Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a podléhají tomuto právně závaznému prohláąení o vyloučení odpovědnosti: https://www.precheza.cz/01-dovetek/ | This email and any documents attached to it may be confidential and are subject to the legally binding disclaimer: https://www.precheza.cz/en/01-disclaimer/

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Strange result for strptime with %p

Rui Barradas
Hello,

Or %H, it also works.

strptime("05/01/18 00:59:59 AM", format = ("%m/%d/%y %H:%M:%S %p"),
tz="Asia/Jayapura")
#[1] "2018-05-01 00:59:59 WIT"


Hope this helps,

Rui Barradas

Às 15:20 de 02/10/2018, PIKAL Petr escreveu:

> Hi
>
> Credit belongs to documentation. I picked it from it.
>
> Cheers
> Petr
>
>> -----Original Message-----
>> From: peter dalgaard <[hidden email]>
>> Sent: Tuesday, October 2, 2018 4:15 PM
>> To: PIKAL Petr <[hidden email]>
>> Cc: Marc Girondot <[hidden email]>; r-help mailing list <r-help@r-
>> project.org>
>> Subject: Re: [R] Strange result for strptime with %p
>>
>> Nice catch, Petr:
>>
>>> strptime("05/01/18 00:59:59 AM", format = ("%m/%d/%y %I:%M:%S %p"),
>>> tz="Asia/Jayapura")
>> [1] NA
>>> strptime("05/01/18 12:59:59 AM", format = ("%m/%d/%y %I:%M:%S %p"),
>>> tz="Asia/Jayapura")
>> [1] "2018-05-01 00:59:59 WIT"
>>
>> -pd
>>
>>> On 2 Oct 2018, at 15:39 , PIKAL Petr <[hidden email]> wrote:
>>>
>>> Hi
>>>
>>> Maybe it is connected to
>>> %I
>>> Hours as decimal number (01–12).
>>>
>>> Your input has hour as 00
>>>
>>> Cheers
>>> Petr
>>>
>>>> -----Original Message-----
>>>> From: R-help <[hidden email]> On Behalf Of Marc
>>>> Girondot via R-help
>>>> Sent: Tuesday, October 2, 2018 3:30 PM
>>>> To: R-help Mailing List <[hidden email]>
>>>> Subject: [R] Strange result for strptime with %p
>>>>
>>>> Dear members... are these results normal ?
>>>>
>>>> For the first one, no problem. I expected this:
>>>>
>>>>> strptime("05/01/18 01:00:00 AM", format = ("%m/%d/%y %I:%M:%S %p"),
>>>> tz="Asia/Jayapura")
>>>> [1] "2018-05-01 01:00:00 WIT"
>>>>
>>>> For this one, it is ok also:
>>>>
>>>>> strptime("05/01/18 01:00:00 AM", format = ("%m/%d/%y %I:%M:%S %p"),
>>>> tz="Asia/Jayapura")-1
>>>> [1] "2018-05-01 00:59:59 WIT"
>>>>
>>>> But how to explain this ???
>>>>
>>>>> strptime("05/01/18 00:59:59 AM", format = ("%m/%d/%y %I:%M:%S %p"),
>>>> tz="Asia/Jayapura")
>>>> [1] NA
>>>>
>>>> Thanks for your advices
>>>> Marc
>>>> ______________________
>>>>
>>>> R 3.5.1 on MacOS 10.14
>>>>
>>>>> version
>>>>                 _
>>>> platform       x86_64-apple-darwin15.6.0
>>>> arch           x86_64
>>>> os             darwin15.6.0
>>>> system         x86_64, darwin15.6.0
>>>> status
>>>> major          3
>>>> minor          5.1
>>>> year           2018
>>>> month          07
>>>> day            02
>>>> svn rev        74947
>>>> language       R
>>>> version.string R version 3.5.1 (2018-07-02)
>>>> nickname       Feather Spray
>>>>
>>>> ______________________________________________
>>>> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
>>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>>> PLEASE do read the posting guide
>>>> http://www.R-project.org/posting-guide.html
>>>> and provide commented, minimal, self-contained, reproducible code.
>>> Osobní údaje: Informace o zpracování a ochraně osobních údajů
>>> obchodních partnerů PRECHEZA a.s. jsou zveřejněny na:
>>> https://www.precheza.cz/zasady-ochrany-osobnich-udaju/ | Information
>>> about processing and protection of business partner’s personal data
>>> are available on website:
>>> https://www.precheza.cz/en/personal-data-protection-principles/
>>> Důvěrnost: Tento e-mail a jakékoliv k němu připojené dokumenty jsou
>>> důvěrné a podléhají tomuto právně závaznému prohláąení o vyloučení
>>> odpovědnosti: https://www.precheza.cz/01-dovetek/ | This email and any
>>> documents attached to it may be confidential and are subject to the
>>> legally binding disclaimer: https://www.precheza.cz/en/01-disclaimer/
>>>
>>> ______________________________________________
>>> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide
>>> http://www.R-project.org/posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>>
>> --
>> Peter Dalgaard, Professor,
>> Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000
>> Frederiksberg, Denmark
>> Phone: (+45)38153501
>> Office: A 4.23
>> Email: [hidden email]  Priv: [hidden email]
>>
>>
>>
>>
>>
>>
>>
>>
>
> Osobní údaje: Informace o zpracování a ochraně osobních údajů obchodních partnerů PRECHEZA a.s. jsou zveřejněny na: https://www.precheza.cz/zasady-ochrany-osobnich-udaju/ | Information about processing and protection of business partner’s personal data are available on website: https://www.precheza.cz/en/personal-data-protection-principles/
> Důvěrnost: Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a podléhají tomuto právně závaznému prohláąení o vyloučení odpovědnosti: https://www.precheza.cz/01-dovetek/ | This email and any documents attached to it may be confidential and are subject to the legally binding disclaimer: https://www.precheza.cz/en/01-disclaimer/
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Strange result for strptime with %p

Jeff Newmiller
... except that the %p is ignored or generates an error (implementation-dependent) if you use %H, so this may only address a few of the values you are processing and then only on some platforms.

On October 2, 2018 8:22:02 AM PDT, Rui Barradas <[hidden email]> wrote:

>Hello,
>
>Or %H, it also works.
>
>strptime("05/01/18 00:59:59 AM", format = ("%m/%d/%y %H:%M:%S %p"),
>tz="Asia/Jayapura")
>#[1] "2018-05-01 00:59:59 WIT"
>
>
>Hope this helps,
>
>Rui Barradas
>
>Às 15:20 de 02/10/2018, PIKAL Petr escreveu:
>> Hi
>>
>> Credit belongs to documentation. I picked it from it.
>>
>> Cheers
>> Petr
>>
>>> -----Original Message-----
>>> From: peter dalgaard <[hidden email]>
>>> Sent: Tuesday, October 2, 2018 4:15 PM
>>> To: PIKAL Petr <[hidden email]>
>>> Cc: Marc Girondot <[hidden email]>; r-help mailing list
><r-help@r-
>>> project.org>
>>> Subject: Re: [R] Strange result for strptime with %p
>>>
>>> Nice catch, Petr:
>>>
>>>> strptime("05/01/18 00:59:59 AM", format = ("%m/%d/%y %I:%M:%S %p"),
>>>> tz="Asia/Jayapura")
>>> [1] NA
>>>> strptime("05/01/18 12:59:59 AM", format = ("%m/%d/%y %I:%M:%S %p"),
>>>> tz="Asia/Jayapura")
>>> [1] "2018-05-01 00:59:59 WIT"
>>>
>>> -pd
>>>
>>>> On 2 Oct 2018, at 15:39 , PIKAL Petr <[hidden email]>
>wrote:
>>>>
>>>> Hi
>>>>
>>>> Maybe it is connected to
>>>> %I
>>>> Hours as decimal number (01–12).
>>>>
>>>> Your input has hour as 00
>>>>
>>>> Cheers
>>>> Petr
>>>>
>>>>> -----Original Message-----
>>>>> From: R-help <[hidden email]> On Behalf Of Marc
>>>>> Girondot via R-help
>>>>> Sent: Tuesday, October 2, 2018 3:30 PM
>>>>> To: R-help Mailing List <[hidden email]>
>>>>> Subject: [R] Strange result for strptime with %p
>>>>>
>>>>> Dear members... are these results normal ?
>>>>>
>>>>> For the first one, no problem. I expected this:
>>>>>
>>>>>> strptime("05/01/18 01:00:00 AM", format = ("%m/%d/%y %I:%M:%S
>%p"),
>>>>> tz="Asia/Jayapura")
>>>>> [1] "2018-05-01 01:00:00 WIT"
>>>>>
>>>>> For this one, it is ok also:
>>>>>
>>>>>> strptime("05/01/18 01:00:00 AM", format = ("%m/%d/%y %I:%M:%S
>%p"),
>>>>> tz="Asia/Jayapura")-1
>>>>> [1] "2018-05-01 00:59:59 WIT"
>>>>>
>>>>> But how to explain this ???
>>>>>
>>>>>> strptime("05/01/18 00:59:59 AM", format = ("%m/%d/%y %I:%M:%S
>%p"),
>>>>> tz="Asia/Jayapura")
>>>>> [1] NA
>>>>>
>>>>> Thanks for your advices
>>>>> Marc
>>>>> ______________________
>>>>>
>>>>> R 3.5.1 on MacOS 10.14
>>>>>
>>>>>> version
>>>>>                 _
>>>>> platform       x86_64-apple-darwin15.6.0
>>>>> arch           x86_64
>>>>> os             darwin15.6.0
>>>>> system         x86_64, darwin15.6.0
>>>>> status
>>>>> major          3
>>>>> minor          5.1
>>>>> year           2018
>>>>> month          07
>>>>> day            02
>>>>> svn rev        74947
>>>>> language       R
>>>>> version.string R version 3.5.1 (2018-07-02)
>>>>> nickname       Feather Spray
>>>>>
>>>>> ______________________________________________
>>>>> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
>>>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>>>> PLEASE do read the posting guide
>>>>> http://www.R-project.org/posting-guide.html
>>>>> and provide commented, minimal, self-contained, reproducible code.
>>>> Osobní údaje: Informace o zpracování a ochraně osobních údajů
>>>> obchodních partnerů PRECHEZA a.s. jsou zveřejněny na:
>>>> https://www.precheza.cz/zasady-ochrany-osobnich-udaju/ |
>Information
>>>> about processing and protection of business partner’s personal data
>>>> are available on website:
>>>> https://www.precheza.cz/en/personal-data-protection-principles/
>>>> Důvěrnost: Tento e-mail a jakékoliv k němu připojené dokumenty jsou
>>>> důvěrné a podléhají tomuto právně závaznému prohláąení o vyloučení
>>>> odpovědnosti: https://www.precheza.cz/01-dovetek/ | This email and
>any
>>>> documents attached to it may be confidential and are subject to the
>>>> legally binding disclaimer:
>https://www.precheza.cz/en/01-disclaimer/
>>>>
>>>> ______________________________________________
>>>> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
>>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>>> PLEASE do read the posting guide
>>>> http://www.R-project.org/posting-guide.html
>>>> and provide commented, minimal, self-contained, reproducible code.
>>>
>>> --
>>> Peter Dalgaard, Professor,
>>> Center for Statistics, Copenhagen Business School Solbjerg Plads 3,
>2000
>>> Frederiksberg, Denmark
>>> Phone: (+45)38153501
>>> Office: A 4.23
>>> Email: [hidden email]  Priv: [hidden email]
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>
>> Osobní údaje: Informace o zpracování a ochraně osobních údajů
>obchodních partnerů PRECHEZA a.s. jsou zveřejněny na:
>https://www.precheza.cz/zasady-ochrany-osobnich-udaju/ | Information
>about processing and protection of business partner’s personal data are
>available on website:
>https://www.precheza.cz/en/personal-data-protection-principles/
>> Důvěrnost: Tento e-mail a jakékoliv k němu připojené dokumenty jsou
>důvěrné a podléhají tomuto právně závaznému prohláąení o vyloučení
>odpovědnosti: https://www.precheza.cz/01-dovetek/ | This email and any
>documents attached to it may be confidential and are subject to the
>legally binding disclaimer: https://www.precheza.cz/en/01-disclaimer/
>>
>> ______________________________________________
>> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
>______________________________________________
>[hidden email] mailing list -- To UNSUBSCRIBE and more, see
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.

--
Sent from my phone. Please excuse my brevity.

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Strange result for strptime with %p

David Winsemius
In reply to this post by R help mailing list-2

> On Oct 2, 2018, at 6:30 AM, Marc Girondot via R-help <[hidden email]> wrote:
>
> Dear members... are these results normal ?
>
> For the first one, no problem. I expected this:
>
> > strptime("05/01/18 01:00:00 AM", format = ("%m/%d/%y %I:%M:%S %p"), tz="Asia/Jayapura")
> [1] "2018-05-01 01:00:00 WIT"
>
> For this one, it is ok also:
>
> > strptime("05/01/18 01:00:00 AM", format = ("%m/%d/%y %I:%M:%S %p"), tz="Asia/Jayapura")-1
> [1] "2018-05-01 00:59:59 WIT"
>
> But how to explain this ???
>
> > strptime("05/01/18 00:59:59 AM", format = ("%m/%d/%y %I:%M:%S %p"), tz="Asia/Jayapura")
> [1] NA

I'm afraid this is "as documented":

%I
Hours as decimal number (01–12).

I see no reason not to use "%H"

--
David.

>
> Thanks for your advices
> Marc
> ______________________
>
> R 3.5.1 on MacOS 10.14
>
> > version
>                _
> platform       x86_64-apple-darwin15.6.0
> arch           x86_64
> os             darwin15.6.0
> system         x86_64, darwin15.6.0
> status
> major          3
> minor          5.1
> year           2018
> month          07
> day            02
> svn rev        74947
> language       R
> version.string R version 3.5.1 (2018-07-02)
> nickname       Feather Spray
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Winsemius
Alameda, CA, USA

'Any technology distinguishable from magic is insufficiently advanced.'   -Gehm's Corollary to Clarke's Third Law

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Strange result for strptime with %p

David Winsemius

> On Oct 2, 2018, at 10:11 AM, David Winsemius <[hidden email]> wrote:
>
>
>> On Oct 2, 2018, at 6:30 AM, Marc Girondot via R-help <[hidden email]> wrote:
>>
>> Dear members... are these results normal ?
>>
>> For the first one, no problem. I expected this:
>>
>>> strptime("05/01/18 01:00:00 AM", format = ("%m/%d/%y %I:%M:%S %p"), tz="Asia/Jayapura")
>> [1] "2018-05-01 01:00:00 WIT"
>>
>> For this one, it is ok also:
>>
>>> strptime("05/01/18 01:00:00 AM", format = ("%m/%d/%y %I:%M:%S %p"), tz="Asia/Jayapura")-1
>> [1] "2018-05-01 00:59:59 WIT"
>>
>> But how to explain this ???
>>
>>> strptime("05/01/18 00:59:59 AM", format = ("%m/%d/%y %I:%M:%S %p"), tz="Asia/Jayapura")
>> [1] NA
>
> I'm afraid this is "as documented":
>
> %I
> Hours as decimal number (01–12).
>
> I see no reason not to use "%H"

If you need to use %I and %p then you may need to pre-process with sub(" 00", " 12", object_name)

 strptime("05/01/18 12:59:59 AM", format = ("%m/%d/%y %I:%M:%S %p"), tz="Asia/Jayapura")
[1] "2018-05-01 00:59:59 WIT"


>
> --
> David.
>>
>> Thanks for your advices
>> Marc
>> ______________________
>>
>> R 3.5.1 on MacOS 10.14
>>
>>> version
>>               _
>> platform       x86_64-apple-darwin15.6.0
>> arch           x86_64
>> os             darwin15.6.0
>> system         x86_64, darwin15.6.0
>> status
>> major          3
>> minor          5.1
>> year           2018
>> month          07
>> day            02
>> svn rev        74947
>> language       R
>> version.string R version 3.5.1 (2018-07-02)
>> nickname       Feather Spray
>>
>> ______________________________________________
>> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
> David Winsemius
> Alameda, CA, USA
>
> 'Any technology distinguishable from magic is insufficiently advanced.'   -Gehm's Corollary to Clarke's Third Law
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Winsemius
Alameda, CA, USA

'Any technology distinguishable from magic is insufficiently advanced.'   -Gehm's Corollary to Clarke's Third Law

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.