Socket
Socket
Sign inDemoInstall

tzconvert

Package Overview
Dependencies
3
Maintainers
1
Alerts
File Explorer

Install Socket

Detect and block malicious and high-risk dependencies

Install

    tzconvert

Make naive datetime objects timezone aware using city names


Maintainers
1

Readme

PyPI version

tzconvert

tzconvert is a simple library for converting a naive, timezone unaware datetime object to it's smarter, timezone aware version.

Installation

Installation is straightforward.

pip install tzconvert

Installing from sources
  • Clone this git repository.

  • cd into the project folder.

  • run python setup.py install

Usage

>>> import tzconvert
>>> import datetime

>>> naive_datetime = datetime.datetime.utcnow()

>>> naive_datetime
datetime.datetime(2020, 4, 21, 22, 36, 27, 945535)

>>> adjusted_datetime = tzconvert.adjust_datetime(naive_datetime, "Venice")

>>> adjusted_datetime
datetime.datetime(2020, 4, 22, 0, 36, 27, 945535, tzinfo=tzoffset('GMT', 7200))

NOTES :

  • adjust_datetime() returns None on failure.
  • adjust_datetime() takes an optional argument debug, set it to True to display debug messages on stdout.

PR's are more than welcome.

FAQs


Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc