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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T13:33:55+00:00 2026-06-14T13:33:55+00:00

The actual table in the database has separate integer fields for storing year ,

  • 0

The actual table in the database has separate integer fields for storing year, month, day, hour and minute values (all in UTC) (seconds and milliseconds are irrelevant for my task and considered equal to zero).

Needless to say it would be of great convenience to have just one field of DateTime type on the application side and hide all the conversion under the cover of the Entity Framework model code.

Any directions on how to do that? I am not very experienced with Entity Framework yet.

  • 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-06-14T13:33:57+00:00Added an answer on June 14, 2026 at 1:33 pm

    I answered a similar question earlier: Can I use Data Annotations or Fluent to convert a value between data store and entity class?

    As far as I know, this is not currently possible in EF.

    What you can do is expose a helper property that is not mapped to the database.

    [NotMapped]
    public DateTime DateTime
    {
      get { return new DateTime( Year, Month, Day, Hour, Minute, 0, DateTimeKind.Utc); }
      set
      {
        Year = value.Year;
        Year = value.Year;
        Month = value.Month;
        Day = value.Day;
        Hour = value.Hour;
        Minute = value.Minute;
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have 20+ tables similar to table 1. Where all letters represent actual values.
I have an application which communicates with a database. Each table has a unique
I have this homework question: Assume a Database table has 0 records at time
I have a database for a forum-like website. It has a 'users' table, which
I have a MySQL database in which table A has a one-to-many relation to
I have a database containing users and roles. The table Users has a reference
I have a simple database table (SQL Server 2008 R2 Express), which has a
I have a table in my database which has information about a bunch of
So I have a simple database with a table that has multiple column, most
Here is my block of CSS: .actual-form table { padding: 5px 0 15px 15px;

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.