Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8316939
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T21:28:29+00:00 2026-06-08T21:28:29+00:00

For simple formats its easy to come up with equivalents PHP: date(Y-m-d) === 2012-07-25;

  • 0

For simple formats its easy to come up with equivalents

PHP:

date("Y-m-d") === "2012-07-25";

Python:

date.strftime("%Y-%m-%d") == "2012-07-25"

But what is the Python equivalent of

date("jS F Y") === "25th July 2012";
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T21:28:30+00:00Added an answer on June 8, 2026 at 9:28 pm

    I’m afraid I think you’ll have to work the suffix out yourself:

    >>> t = time.localtime()
    >>> suffix = 'st' if t.tm_mday in [1,21,31] else 'nd' if t.tm_mday in [2, 22] else 'rd' if t.tm_mday in [3, 23] else 'th'
    >>> time.strftime('%d%%s %B %Y', t) % suffix
    '25th July 2012'
    

    It’s a bit English-centric for a programming language feature, so you can see why they didn’t include it.

    *Edited to add the “rd” suffix for 3rd and 23rd.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to do a simple date format, it does work great, it's very
How could I define a simple hierarchy in some easy to read format and
I'm using a jQueryUI datepicker for a simple From & To date range filter
In Python, I can use decorators to trace the function call, its variables and
I need a script that simply formats a value (eg 4567643) to (4,567,643). No
Is there a simple way to format that single heading and turn those heading
Simple regex question. I have a string on the following format: this is a
I have a simple piece of code: txtRequiredDate.setText(wwDateFormatter.format(todoEntity.getRequiredDate())); txtRequiredDateDay.setText(dayOfWeek(todoEntity.getRequiredDate())); txtDoneDate.setText(wwDateFormatter.format(todoEntity.getDoneDate())); txtDoneDateDay.setText(dayOfWeek(todoEntity.getDoneDate())); Problem is that
I have a String Object in format yyyyMMdd .Is there a simple way to
I'm writing a simple batch downloader for files, which have the format Y-m-d.pdf. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.