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 7608213
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T00:51:36+00:00 2026-05-31T00:51:36+00:00

I have this string: ‘2012-02-10’ # (year-month-day) and I need it to be as

  • 0

I have this string:

'2012-02-10' # (year-month-day)

and I need it to be as date type for me to use the date function isoweekday().

Does anyone know how I can convert this string into a date?

  • 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-05-31T00:51:37+00:00Added an answer on May 31, 2026 at 12:51 am

    You can do that with datetime.strptime()

    Example:

    >>> from datetime import datetime
    >>> datetime.strptime('2012-02-10' , '%Y-%m-%d')
    datetime.datetime(2012, 2, 10, 0, 0)
    >>> _.isoweekday()
    5
    

    You can find the table with all the strptime directive here.


    To increment by 2 days if .isweekday() == 6, you can use timedelta():

    >>> import datetime
    >>> date = datetime.datetime.strptime('2012-02-11' , '%Y-%m-%d')
    >>> if date.isoweekday() == 6:
    ...     date += datetime.timedelta(days=2)
    ... 
    >>> date
    datetime.datetime(2012, 2, 13, 0, 0)
    >>> date.strftime('%Y-%m-%d')   # if you want a string again
    '2012-02-13'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this string containing a date I need to parse to get a
I have this string 2012-06-27 16:17:06 and I want to convert it to GMT
I have this string: 123-456-7 I need to get this string: 1234567 How I
I have this string aa b qqidjwljd p fjem I need to replace b
I have this string: tag:domain.com,2012-10-12:feed/channel/id/335 Im trying to get the last digits from this
I have this string in serialize format a:6:{s:5:width;i:452;s:6:height;i:336;s:14:hwstring_small;s:23:height='96' width='128';s:4:file;s:20:2012/01/Picture3_410_1325761656.jpg;s:5:sizes;a:8:{s:9:thumbnail;a:3:{s:4:file;s:35:Picture3_410_1325761656-162x160.jpg;s:5:width;i:162;s:6:height;i:160;}s:6:medium;a:3:{s:4:file;s:35:Picture3_410_1325761656-258x191.jpg;s:5:width;i:258;s:6:height;i:191;}s:8:post-top;a:3:{s:4:file;s:35:Picture3_410_1325761656-110x110.jpg;s:5:width;i:110;s:6:height;i:110;}s:9:post-tiny;a:3:{s:4:file;s:35:Picture3_410_1325761656-108x100.jpg;s:5:width;i:108;s:6:height;i:100;}s:9:post-item;a:3:{s:4:file;s:35:Picture3_410_1325761656-452x327.jpg;s:5:width;i:452;s:6:height;i:327;}s:11:post-review;a:3:{s:4:file;s:35:Picture3_410_1325761656-162x166.jpg;s:5:width;i:162;s:6:height;i:166;}s:9:post-poll;a:3:{s:4:file;s:35:Picture3_410_1325761656-285x237.jpg;s:5:width;i:285;s:6:height;i:237;}s:14:post-top-story;a:3:{s:4:file;s:35:Picture3_410_1325761656-300x130.jpg;s:5:width;i:300;s:6:height;i:130;}}s:10:image_meta;a:10:{s:8:aperture;i:0;s:6:credit;s:0:;s:6:camera;s:0:;s:7:caption;s:0:;s:17:created_timestamp;i:0;s:9:copyright;s:0:;s:12:focal_length;i:0;s:3:iso;i:0;s:13:shutter_speed;i:0;s:5:title;s:0:;}} which is used in wordpress
I have this string, which is generated by dojo.toJson() function: {page:accommodation task=viewList,language:undefined} When decoding
I have this string : 000000000000100 and need to convert it to: 1,00 So,
I have this string <p><img src=http://www.foo.com/bar.jpg></p><p>other content here</p> I need to extract the src
I have this string: type=openBook&bookid=&guid=7AD92237-D3C7-CD3E-C052-019E1EBC16B8&authorid=&uclass=2&view= Then I want to get all the values after

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.