---
title: "strftime() Method"  
description: "strftime() Method"  
author: "Anonymous User"  
published: 2018-07-06  
updated: 2018-07-06  
canonical: https://www.mindstick.com/forum/34583/strftime-method  
category: "python"  
tags: ["python-3.4", "python"]  
reading_time: 1 minute  

---

# strftime() Method

How to use time and [date](https://yourviews.mindstick.com/story/3869/propose-day-2024-exciting-date-ideas-for-you-and-your-partner) [function](https://www.mindstick.com/articles/13001/multi-statement-table-valued-user-defined-function-in-sql-server) in [python](https://www.mindstick.com/articles/75378/simple-yet-useful-tips-when-using-python) ?

## Replies

### Reply by Prakash nidhi Verma

Python Date: in python data type are not created but we can import a module with dates as date objects in that sequence.Import datetime module and display current date:

```
import datetime x = datetime.datetime.now()
print(x)
```

```
2018-07-06 2:44:07.670539
```

The date having year, month, day, hour, minute, second, microsecond. The datetime module has many methods to return information about the date object. Return the year and name of weekday:

```
import datetime x = datetime.datetime.now()
print(x.year)
print(x.strftime("%A"))
```

Creating Date Objects :

you can use the datetime() class (constructor) of the datetime module for creating a date. The datetime() class requires three parameters to create a date: year, month, day.

Create a date object:

```
import datetime x = datetime.datetime(2020,6,20)
print(x)
```

The strftime() Method:

The datetime object has a method for formatting date objects into readable strings.

Display the name of the month:

```
import datetime x = datetime.datetime(2018, 6, 1)
print(x.strftime("%B"))
```


---

Original Source: https://www.mindstick.com/forum/34583/strftime-method

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
