You need to import the module datetime
first:
>>> import datetime
After that it works:
>>> import datetime
>>> date = datetime.date.today()
>>> date
datetime.date(2013, 11, 12)
More Related Contents:
- Convert python datetime to epoch with strftime
- How to parse dates with -0400 timezone string in Python?
- Creating a range of dates in Python
- How do I calculate the date six months from the current date using the datetime Python module?
- Convert pandas timezone-aware DateTimeIndex to naive timestamp, but in certain timezone
- Plotting dates on the x-axis with Python’s matplotlib
- datetime dtypes in pandas read_csv
- Generate a random date between two other dates
- How do I get the UTC time of “midnight” for a given timezone?
- pandas dataframe groupby datetime month
- ISO time (ISO 8601) in Python
- pytz localize vs datetime replace
- Generate a list of datetimes between an interval
- Convert Year/Month/Day to Day of Year in Python
- How to get day name from datetime
- python converting string in localtime to UTC epoch timestamp
- Pandas: Datetime Improperly selecting day as month from date [duplicate]
- Convert String with month name to datetime
- Generate RFC 3339 timestamp in Python [duplicate]
- Specifying date format when converting with pandas.to_datetime
- How to monkeypatch python’s datetime.datetime.now with py.test?
- How to get the seconds since epoch from the time + date output of gmtime()?
- Datetime conversion – How to extract the inferred format?
- Parsing a date that can be in several formats in python
- Formatting “yesterday’s” date in python
- Python: Datetime to season
- finding last business day of a month in python
- Python strptime parsing year without century: assume prior to this year?
- Pandas datetimes with different formats in the same column
- Get weekday/day-of-week for Datetime column of DataFrame