You can use strftime to help you format your date.
E.g.,
import datetime
t = datetime.datetime(2012, 2, 23, 0, 0)
t.strftime('%m/%d/%Y')
will yield:
'02/23/2012'
More information about formatting see here
More Related Contents:
- Converting datetime.date to UTC timestamp in Python
- Format timedelta to string
- Format a datetime into a string with milliseconds
- How to make a timezone aware datetime object
- How to format date string via multiple formats in python
- How do I read a date in Excel format in Python?
- Pandas: Subtracting two date columns and the result being an integer
- How do I get the current time in milliseconds in Python?
- Parsing time string in Python
- Converting epoch time with milliseconds to datetime
- Query Mongodb on month, day, year… of a datetime
- Splitting timestamp column into separate date and time columns
- Python Create unix timestamp five minutes in the future
- How to check if the current time is in range in python?
- Comparing two date strings in Python
- Get year, month or day from numpy datetime64
- Difference between Python datetime vs time modules
- Natural/Relative days in Python
- Why can’t I subclass datetime.date?
- Extract time from datetime and determine if time (not date) falls within range?
- Convert string “Jun 1 2005 1:33PM” into datetime
- Python pandas convert datetime to timestamp effectively through dt accessor
- Get time zone information of the system in Python?
- Locate first and last non NaN values in a Pandas DataFrame
- Format of datetime in pyplot axis
- Pandas custom function to find whether it is the 1st, 2nd etc Monday, Tuesday, etc – all suggestions welcome
- Formatting “yesterday’s” date in python
- Get UTC offset from time zone name in python
- Python strptime parsing year without century: assume prior to this year?
- Get weekday/day-of-week for Datetime column of DataFrame