Gets the time from specific locations.
Project description
Introduction
TimeQuery is a Python module that allows you to get the time from anywhere in the world. It is designed to be more user-firendly then datetime and zoneinfo, and is programmed to act as a midway point between your application and these two modules. Designed to be as simple as possible, TimeQuery is small and yet effective in many ways.
Usage
In order to get the time from anywhere in the world, you first need to use the now_in(...)
function. In order to use now_in(...)
, you simply pass the location of where you want to tell the time into it's only parameter: "cont
". An example is shown below:
>>> loc = TimeQuery.now_in('Japan')
If a country has more than one timezone, you can do this:
>>> loc = TimeQuery.now_in('Chile/EasterIsland')
This "now_in(...)
" function will then return data which can be stored in a variable or passed into the next function, which will output the time itself - now(...)
. An example of you to use "now(...)
" is shown below:
>>> TimeQuery.now(loc)
If you used the code from before, you should have a readout of the time on your screen, featuring the date (in DMY form - you will know how to change this in a sec), 12 hour time, 24 hour time, and the current timezone you are in (abbreviated).
If you wish to have that date written out in a different form, you can use the following
command:
>>> TimeQuery.now(loc, TimeQuery.time_formats['ymd all'])
This will show the time exactly same as before, but the data is now in YMD form. \
Formatting Options
The formatting dictionary, as it currently is, has these options:
Day-Month-Year
Time-Inc
dmy date 12hr apm zone
dmy date 24hr zone
dmy date 12hr apm
dmy date 24hr
No-Time
dmy date
dmy date zone
Year-Month-Day
Time-Inc
ymd date 12hr apm zone
ymd date 24hr zone
ymd date 12hr apm
ymd date 24hr
No-Time
ymd date
ymd date zone
Month-Day-Year
Time-Inc
mdy date 12hr apm zone
mdy date 24hr zone
mdy date 12hr apm
mdy date 24hr
No-Time
mdy date
mdy date zone
Time Only
12hr apm
24hr
12hr apm zone
24hr zone
24hr / 12hr apm
24hr / 12hr apm zone
Special - "All"
all dmy
all ymd
all mdy
Timezone [Special]
tz
Getting the Areas
It is quite hard to predict the names of the "zoneinfo
places". That is why TimeQuery includes the function tzfold()
, which will show you to the path(s) to the folder that all the "places" are in. In this folder, all the countries that only have one timezone are files. All the countries that have multiple are represented as folders, with the areas that have their own timezone within that "country folder". Note that several time-related acronyms can be located in the main and sub folders. Example usage is shown below:
>>> path = TimeQuery.tzfold()
Technical ⚙️
There is nothing too technical in this module.
Credits
This module was put together by:
Pigeon Nation :]
This module is mainly a in-between script. The true functionality that makes this module work comes from datetime and zoneinfo; this module just makes things simpler and more understandable.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file TimeQuery-1.0.0.tar.gz
.
File metadata
- Download URL: TimeQuery-1.0.0.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5539572835ca8adca6e1b698348b36dddb06783e3585eb20fbac009e23182b3b |
|
MD5 | dfa97b0a40d4d7ce4ddb04c418ffc4a0 |
|
BLAKE2b-256 | 1e80c42c3ed95e36d210c7edbe522f5cc73e73cf453d9c14c7ac9bad69436bb5 |
File details
Details for the file TimeQuery-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: TimeQuery-1.0.0-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ddfa18839f0dcf97b99440855fd73403c2c0ef5e6725f0419a11212b70da6451 |
|
MD5 | 9adb2f4646a15cc1a6fbf26ea613d1c1 |
|
BLAKE2b-256 | f0f7eee56522af369fcc41ab3b4a94a42a28d4d8c40a2ee5dc022376708d04ba |