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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T15:25:17+00:00 2026-05-22T15:25:17+00:00

I have 1 datetime field that is not nullable and 1 that is nullable.

  • 0

I have 1 datetime field that is not nullable and 1 that is nullable. I can use the following code with the non nullable one :

 c.StartDate.Day.ToString() + "/" + 
 c.StartDate.Month.ToString() + "/" + 
 c.StartDate.Year.ToString()

But when I try to do this with the nullable one, I get the error :

‘System.Nullable’ does not contain a definition for ‘Day’ and no extension method ‘Day’ accepting a first argument of type ‘System.Nullable’ could be found (are you missing a using directive or an assembly reference?)

How do I get the Day, Month, Year of a nullable datetime?

  • 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-22T15:25:18+00:00Added an answer on May 22, 2026 at 3:25 pm

    You’ll have to use the .Value property on your nullable:

    c.StartDate.Value.Day.ToString()  //etc
    

    After checking for null, you could:

     c.StartDate.Value.ToString("dd-MMM-yyyy");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a column that uses the DateTime format that was set in the
I have an SQL view with a field as such: To_char(date, 'MM-DD-YYYY') I have
Okay, I appreciate that the question is a tad vague, but after a day
I have some daily analytics-style records that track usage on my site, and they
I am using rails 3 with mongoid. I have a collection of Stocks with
I have article model with public ICollection<Comment> Comments { get; set; } and comment
I am trying to figure out the best way to display all records by
i building a mini forum site.. and i constructed a few tables. 1) Users
I had a problem with my application. To resume the problem, I had to
EDIT AGAIN : I don't want to create another question, so asking here. I

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.