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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T01:54:40+00:00 2026-05-24T01:54:40+00:00

Problem statement: There is a path that contains a date in a specific format

  • 0

Problem statement:

  • There is a path that contains a date in a specific format which is a configuration parameter. Say, “yyyy_MMM_d”,
  • I need to detect if the path contains such a date:
    • if it does, change it to a new date.
    • if it doesn’t, append the new date to the path
  • The existing date in the path could be any date, it’s not always yesterday’s or tomorrow’s.

Attempted solution:

  • Detect via Regex (in the example \d{4}_[a-zA-Z]{3}_\d{1,2}) the portion that resembles the date and validate it afterwards using TryParseExact()
    • This works for a constant format, but I’d need to write a format to regexp compiler to support when the parameter changes. This isn’t really worth the effort.

So, any other solution? I think that if there’s no better way than what I have, I could probably demand a regex parameter next to the date format parameter 🙂

  • 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-24T01:54:41+00:00Added an answer on May 24, 2026 at 1:54 am

    Split the string on the slash delimiters. In a while loop, have a check that determines if it is a valid datetime string. If not, go to the next piece. If you get through every piece, you have no date, so append one.

    Note, I’m not a .net developer, and as such, this could be something horrible and nasty that should never see the light of day…

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

Sidebar

Related Questions

I am having the problem that I cannot select a specific XML node which
What are the steps that you follow when approaching a problem statement, which needs
Problem statement: Implement a plug-in system that allows the associated assemblies to be overwritten
I have problem in some JavaScript that I am writing where the Switch statement
Problem (simplified to make things clearer): 1. there is one statically-linked static.lib that has
Problem statement I have a worker thread that basically scans a folder, going into
I'm having some problems with encapsulation in C#. There are two specific scenarios that
Problem: I have an address field from an Access database which has been converted
Problem: I have two spreadsheets that each serve different purposes but contain one particular
Problem: Ajax suggest-search on [ n ] ingredients in recipes. That is: match recipes

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.