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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T07:17:54+00:00 2026-05-20T07:17:54+00:00

DateTime.Today is static readonly . So supposedly it should never change once (statically) instantiated.

  • 0

DateTime.Today is static readonly. So supposedly it should never change once (statically) instantiated.

However — if I fire up an application and ask for the date at 11:59pm and then again at 12:01am, it will correctly give me different values each time i call it, right?

Let’s say I wanted to create a static readonly “DateTime.TwoDaysFromNow” (just a representative example) that behaves the same way. .NET will tell me I can’t b/c it’s a readonly remember! How can I make it work?

Much appreciated,
-Alan.

  • 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-20T07:17:54+00:00Added an answer on May 20, 2026 at 7:17 am
    public static DateTime TwoDaysFromNow
    {
        get { return DateTime.Today.AddDays(2); }
    }
    

    You can tell DateTime.Today is a property from Microsoft’s Syntax of it:

    public static DateTime Today { get; }

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

Sidebar

Related Questions

Why my for works incorrect here ? int dayOfWeekNumber = (int)DateTime.Today.DayOfWeek - (int)System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.FirstDayOfWeek; var
Is it possible to use [Range] annotation for dates? something like [Range(typeof(DateTime), DateTime.MinValue.ToString(), DateTime.Today.ToString())]
i have the following code def get(self): date = datetime.date.today() loc_query = Location.all() last_cursor
I am using DateTime.Now to show something according to today's date, and when working
I have a datetime object, dt , that holds today's date. DateTime dt =
In C# I need to compare the value of DateTime.Today /6pm, to a field
<asp:TextBox ID=txtDate runat=server Value=<%= DateTime.Today.ToShortDateString() %> /> Value=<%= DateTime.Today.ToShortDateString() %> does not write date
What is wrong with the following statement? XmlTextWriter writer = new XmlTextWriter(@"D:\project\data\" + System.DateTime.Today
While profiling my application I found that DateTime.FromFileTime(long fileTime) is slow. Does anyone know
string filename = DateTime.Today.ToString() + .csv; if(!File.Exists(filename)) File.Create(filename); I thought this would work but

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.