user2106353
user2106353

Reputation: 1249

get current month in spanish language Python

Hi i am using a variable `in my template file which gives me a current month value in english

{{currentMonth}}

how can i convert this into spanish language

Upvotes: 0

Views: 2153

Answers (1)

Pratik Mandrekar
Pratik Mandrekar

Reputation: 9568

You will need to have a date passed to your template from the view. Then to get the current month you need to do

{{ mydate|date:"F" }}

This will give you the month name i.e January using template tags and filters

To get it in Spanish, enable Spanish by enabling internationalization and creating localization strings for Spanish. You can even use the humanize template tag which has localizations available in Spanin

Upvotes: 1

Related Questions