I tried using the Datetime module by Python

I tried using Python's datetime module

Overview

Thank you for visiting. This time, I'm going to use Datime mainly in the Python library, so please take a look to the end if you like. Immediately, the reason I studied the module called Datetime and posted it to Qiita this time is because I used the module called Datetime in my business. At first I didn't understand it at all, but I was able to read and understand the book ** Self-study Python **. I will post this on the link so please have a look.

What is datetime?

datetime stands for date and time. Modules are parts, so please remember that = parts that represent the date and time. First, I will introduce the main modules of datetime.

Mold Overview
datetime date/Time value
date Date value
time Time value
timezone Time zone information
timedelta Time interval(Because I couldn't read kanji)

** Here are some example sentences. ** **

import datetime #Module import

#①
print(datetime.datetime.today()) #output(module.date/Time value.today)=つまりtodayのdate/時刻をoutput
print(datetime.date.today()) #output(module.Date value.today)=つまりtodayの日付をoutput

#②
#It will be a little longer. Conclusion = Output to know the time zone.

#③
print(datetime.datetime.now(datetime.timezone(datetime.timedelta(hours=0))))
#Output (module.date/Time value.now(module.Time zone information(module.Time interval(Time = how many hours))))


Output result=================================================
#(* This is an example because the dates and times are not all the same.)
#① 2020-08-10 22:08:11.888987
#② 2020-08-10
#③ 2020-08-10 22:08:11.888987+00:00
=======================================================

Recommended Posts

I tried using the Datetime module by Python
I tried using the python module Kwant for quantum transport calculation
vprof --I tried using the profiler for Python
[Python] I tried using OpenPose
[Python] Class type and usage of datetime module
I tried using the Datetime module by Python
I tried to analyze the New Year's card by myself using python
I tried using Thonny (Python / IDE)
Try using the Python Cmd module
I tried using the checkio API
[Python] I tried using YOLO v3
I tried using the Python library from Ruby with PyCall
Why can I use the module by importing with python?
Miscellaneous notes that I tried using python for the matter
[Python] I tried collecting data using the API of wikipedia
I tried using Bayesian Optimization in Python
I tried using UnityCloudBuild API from Python
Python: I tried the traveling salesman problem
I tried the Python Tornado Testing Framework
I tried using the BigQuery Storage API
I tried using parameterized
I tried "smoothing" the image with Python + OpenCV
I tried using argparse
I tried using scrapy for the first time
I tried using mimesis
[Python] I tried substituting the function name for the function name
I tried web scraping using python and selenium
I tried "differentiating" the image with Python + OpenCV
[Python] Let's execute the module regularly using schedule
I tried using aiomysql
I tried object detection using Python and OpenCV
I tried using Summpy
I tried Python> autopep8
I tried simulating the "birthday paradox" in Python
I tried the least squares method in Python
I tried using PyCaret at the fastest speed
I tried using Pipenv
I tried using the Google Cloud Vision API
I tried using matplotlib
I tried python programming for the first time.
I tried using mecab with python2.7, ruby2.3, php7
I tried using ESPCN
[I tried using Pythonista3] Importing my own module
I tried using openpyxl
I tried "binarizing" the image with Python + OpenCV
I tried using Ipython
I tried using PyCaret
I tried reading a CSV file using Python
I tried using cron
I tried using "Streamlit" which can do the Web only with Python
I tried using ngrok
I tried to verify and analyze the acceleration of Python by Cython
I tried using face_recognition
I tried using Jupyter
Try using the collections module (ChainMap) of python3
I tried adding a Python3 module in C
I tried using PyCaret
I tried using Heapq
I tried using doctest
I tried Python> decorator
I tried using the image filter of OpenCV
I tried using folium