Python Forum
[SOLVED] Alternative to regex to extract date from whole timestamp?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[SOLVED] Alternative to regex to extract date from whole timestamp?
#1
Hello,

Python being such a rich language, I was wondering if it provides a ready-to-use function to extract juste the date from a whole timestamp instead of using a regular expression:

#Thu, 10 Nov 2022 18:15:41 +0000
pattern_pubDate = re.compile('(\d{2}) (\w+?) (\d{4})')
…
m = pattern_pubDate.search(link.pubDate.string)
if m:
	pubDate = m.group(0)
I'm only interested in the date.

Thank you.
Reply


Messages In This Thread
[SOLVED] Alternative to regex to extract date from whole timestamp? - by Winfried - Nov-16-2022, 08:41 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Compare current date on calendar with date format file name Fioravanti 1 292 Mar-26-2024, 08:23 AM
Last Post: Pedroski55
  Twilio alternative jmair 3 3,939 Feb-08-2024, 01:55 PM
Last Post: Sharmi
  Python date format changes to date & time 1418 4 680 Jan-20-2024, 04:45 AM
Last Post: 1418
  [solved] Regex expression do not want to taken :/ SpongeB0B 2 834 Nov-06-2023, 02:43 PM
Last Post: SpongeB0B
  Pillow alternative? kucingkembar 4 921 Jul-27-2023, 10:50 AM
Last Post: Larz60+
  Help with a regex? (solved) wrybread 3 867 May-01-2023, 05:12 AM
Last Post: deanhystad
  [SOLVED] [regex] Why isn't possible substring ignored? Winfried 4 1,123 Apr-08-2023, 06:36 PM
Last Post: Winfried
  [SOLVED] Epoch timestamp without milliseconds? Winfried 5 3,131 Jan-27-2023, 04:35 PM
Last Post: deanhystad
  error in timestamp Led_Zeppelin 3 3,287 Jun-15-2022, 08:28 PM
Last Post: deanhystad
  error in timestamp Led_Zeppelin 0 1,024 Jun-10-2022, 07:59 PM
Last Post: Led_Zeppelin

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020