3

How to convert s = "2018-03-17T15:30:00.000Z" to Paris local time?

I've seen solutions involving:

  • arrow:

    import arrow
    print(arrow.get("2018-03-17T15:30:00.000Z").to('Europe/Paris').datetime)
    

    but some posts mention it to be not maintained anymore

  • pendulum:

    import pendulum
    print(pendulum.parse("2018-03-17T15:30:00.000Z"))
    

    (seems faster than pytz)

  • pytz is often cited as a reference because it uses a popular timezone database (Olson timezone database?)

What is a production-ready way to convert UTC datetimes to local time, with a well maintained world timezone/DST database? (I learnt recently that these things change often at least in some places of the world)

Basj
  • 41,386
  • 99
  • 383
  • 673
  • [On topic](http://stackoverflow.com/help/on-topic) and [how to ask](http://stackoverflow.com/help/how-to-ask) apply here. Requesting an off-site resource is specifically proscribed. – Prune Mar 16 '18 at 16:37
  • @Prune An off-site resource? What distinguishes Python from pytz? They are both off-site tools (one is a programming language, the other one is a library, but still they are off-site). Then are Python questions questions involving off-site resources? – Basj Mar 16 '18 at 16:38
  • You're asking for a package well-maintained data base, no? That's my sticking point. – Prune Mar 16 '18 at 16:41
  • @Prune Well I'm just looking for a solution for a specific task (convert UTC time to local time-zone, in an accurate way). – Basj Mar 16 '18 at 16:43
  • None of the prior postings or resources cover all the cases for you? For [instance](https://stackoverflow.com/questions/4770297/convert-utc-datetime-string-to-local-datetime-with-python) ... ? – Prune Mar 16 '18 at 16:48
  • I already read this question @Prune but it doesn't cover the particular comparison between mentioned libraries. – Basj Mar 16 '18 at 17:10
  • You seem to already have an answer with pendulum or pytz. Also dateutil. So it seems you are only asking for opinions. – Matt Johnson-Pint Mar 16 '18 at 18:27

0 Answers0