For a time field, use:
import time
time.strftime('%Y-%m-%d %H:%M:%S')
I think strftime
also applies to datetime
.
More Related Contents:
- How to insert a space delimited text file into mysql using Python? [closed]
- How do I connect to a MySQL Database in Python?
- Converting between datetime, Timestamp and datetime64
- How to construct a timedelta object from a simple string
- Why do integers in database row tuple have an ‘L’ suffix?
- Combine Date and Time columns using python pandas
- Parsing date with timezone from an email?
- Database does not update automatically with MySQL and Python
- How to increment datetime by custom months in python without using library [duplicate]
- Python: best practice and securest way to connect to MySQL and execute queries
- Find the closest date to a given date
- How to increment a datetime by one day?
- Datetime Timezone conversion using pytz
- Parsing datetime in Python..?
- Python Pandas Group by date using datetime data
- Convert numpy.datetime64 to string object in python
- How can I use executemany to insert into MySQL a list of dictionaries in Python
- PyMySQL can’t connect to MySQL on localhost
- Installing MySQL-python
- Executing “SELECT … WHERE … IN …” using MySQLdb
- Pythonic difference between two dates in years?
- Get the Olson TZ name for the local timezone?
- Pandas: How to create a datetime object from Week and Year?
- Plotting dates on the x-axis
- Python pandas integer YYYYMMDD to datetime
- Warning raised by inserting 4-byte unicode to mysql
- Formatting “yesterday’s” date in python
- Python: Datetime to season
- Python strptime parsing year without century: assume prior to this year?
- Pandas datetimes with different formats in the same column