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

  • Home
  • SEARCH
  • 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 6859229
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:15:25+00:00 2026-05-27T02:15:25+00:00

Need to check if DateTime is in specific range. I think I need to

  • 0

Need to check if DateTime is in specific range.
I think I need to calculate knowing YEAR first and last date of DST time in this year.

How would I figure “Sunday of week 2 of March” date?

From 1/1/2007 12:00:00 AM to 12/31/9999 12:00:00 AM
  Begins at 2:00 AM on Sunday of week 2 of March
  Ends at 2:00 AM on Sunday of week 1 of November

For example, I need to check if 11/21/2011 is between Sunday of week 2 in March and Sunday of week 1 of November – answer should be NO

If I pass 8/8/2011 – answer should be yes.

Basically, I need to write function to check if my date belongs to daylight savings time. My only idea so far is to write loops to find 2nd week for example.

So, I would loop from Day 1 in March until I hit Sunday second time. Same thing I would loop (increment days by 1) from day 1 of November until I hit Sunday first time.

In another words, I need function to check if input data is in Daylight Savings time period. Time period defined by constraint above.

P.S. I can’t use TimeZoneInfo since it’s in Silverlight
P.P.S I can’t use DateTime.IsDaylightSavingsTime as I don’t have times with kind “local”

  • 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-27T02:15:25+00:00Added an answer on May 27, 2026 at 2:15 am

    I just did this little method, check it and let me know:

        bool IsInDaylightSavingsTime(DateTime date)
        {
            // get second sunday in march
            DateTime _tempDateMar = new DateTime(date.Year, 3, 1);
            int secondSunDayInMar = (8 - (int)_tempDateMar.DayOfWeek) + 7;
            _tempDateMar = new DateTime(date.Year, 3, secondSunDayInMar, 2, 0, 0);
    
            //get first sunday in november
            DateTime _tempDateNov = new DateTime(date.Year, 11, 1);
            int firstSunDayInNov = (8 - (int)_tempDateNov.DayOfWeek);
            _tempDateNov = new DateTime(date.Year, 11, firstSunDayInNov, 2, 0, 0);
    
            return (date >= _tempDateMar && date <= _tempDateNov);
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i need to check for a specific DateTime value in my table from my
i want something like this the user enter a website link i need check
I need to check a difference between a given date and current date is
I need to check if a date(in string) exists in array list. I have
I need to check is there any object exist for given time Interval? How
I need to compare two files based on datetime. I need to check whether
I need to check if some number of years have been since some date.
When a function runs I need it to check the current system time and
I need to check programmatically (in .NET) whether a given user (domain account) is
I need to check the RequestType of an HttpRequest in ASP.NET (or WebRequest.Method ).

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.