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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:29:00+00:00 2026-05-27T00:29:00+00:00

My program accepts date in the format of yyyymmdd, I don’t know how to

  • 0

My program accepts date in the format of “yyyymmdd”, I don’t know how to check if it’s a weekday or not. I’ve seen ppl using $(date +%u) -gt 5 or "$(date +%a)" in Sat|Sun echo "weekend" in other threads, but that ${date} is like Tue Nov 22 14:16:35 EST 2011 I guess. So is there a good way to convert “yyyymmdd” to ${date} format? Or is there a simple way to check if “yyyymmdd” is a weekday or not? Any language is fine. Thanks.

  • 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-27T00:29:01+00:00Added an answer on May 27, 2026 at 12:29 am

    Any language? In Java I’d use SimpleDateFormat or Joda Time’s DateTimeFormatter. In C# I’d either use DateTime.ParseExact or Noda Time‘s LocalDatePattern. In all of these cases, the result is a value which can be asked for things like the day of the week.

    In Python I suspect you want datetime.strptime, e.g.

    date = datetime.strptime(text, "%Y%m%d")
    day = date.weekday()
    
    if day < 5 # Monday(0) to Friday(4)
        # Do something here
    

    This is completely untested, however…

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

Sidebar

Related Questions

I'm using jcreatorLE and JDK 1.6 to run my program. I don't know why
I have a program that calculates whether or not a date entered by a
I'm trying to sort the lines returned by a console program by date, using
My program accepts up to 4 connections (using select function). Once they're connect, they
I wrote a program that accepts and outputs Hebrew (i.e. right-to-left) text. In lieu
I have a small server program that accepts connections on a TCP or local
I've got an event-driven network server program. This program accepts connections from other processes
I'm using lex in my program and I've run into a problem I need
I have a program that accepts a Cmd command as a command argument. Basically
I have a table view that displays dates using a NSDateFormatter to format them

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.