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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T21:59:18+00:00 2026-05-22T21:59:18+00:00

Ok, I am not sure how to approach this… I am using an open

  • 0

Ok, I am not sure how to approach this… I am using an open source CMS (Umbraco) and want to create a macro that rotates content every three weeks. So basically I have three documents and I want to show document 1, 2 or 3 each week (total three week rotation) based on a given start date… Any suggestions? I suck at working with dates in C#!

I don’t need any specific code other than a C# function that spits back week 1, 2 or 3 given start 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-22T21:59:19+00:00Added an answer on May 22, 2026 at 9:59 pm

    This works, although you may want to adjust it if you always want the weeks to start on a given day (e.g. Sunday).

            DateTime startDate = new DateTime(2011, 1, 1).Date;
            DateTime now = DateTime.Now.Date;
            int days = (int)now.Subtract(startDate).TotalDays;
            int weeks = days / 7;
            Console.WriteLine((weeks % 3) + 1);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm not sure how to approach this: I want a TreeView that will display
I am using asp.net mvc and I am not sure how to approach this
Not sure how to approach this problem. Basically, I want a Pixel -> Tile
I'm not sure how to approach this SQL statement so please advise, even if
I'm not sure how to approach this or if it is even feasible. I
Hoping you can help as im not sure how to approach this. Cant seem
Not totally sure how to approach this. I've researched a bit but I've come
I'm not quite sure how to approach this issue: I am creating a web
I'm not sure how to approach queries that don't map 1:1 to my persistent
Not sure if this counts as programming related, it's a tool that I use.

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.