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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T10:20:56+00:00 2026-06-10T10:20:56+00:00

I have some database values which store the start time of breaks and their

  • 0

I have some database values which store the start time of breaks and their duration, but the Time values are stored as Decimals. For an instance

12.45 = 12:45 PM
12:59 = 12:45 PM
13.0  = 13:00 PM

Duration is stored as int; 30 = 30 mins

Here I have to check if particular time is in between the range, so I have used C# and Entity Framework, and I have used the following code, but it gives an error that DateTime.Parse cannot be identified by LINQ.

STAR_TIME is the time which is stored as 12.45 and
DURATION is stored as 30
and timE is a datetime type

meal ml = HRM.meals.SingleOrDefault(p => p.SHIFTCODE == ShiftCode
                               && DateTime.Parse(p.STAR_TIME.ToString().Replace(".", ":")) <= timE
                               && DateTime.Parse(p.STAR_TIME.ToString().Replace(".", ":")).AddMinutes(int.Parse(p.DURATION.ToString())) >= timE
                              );

Then instead of converting I tried to multiply by 60 and tried to compare values as below, but its logic is wrong.
Here 12.59 is used as the time

  meal ml = HRM.meals.SingleOrDefault(p => p.SHIFTCODE == ShiftCode
  && p.STAR_TIME*60 <= new Decimal(12.59)*60
  && p.STAR_TIME*60 + p.DURATION >= new Decimal(12.59) * 60 
                             );

STAR_TIME — 12.45 * 60 — 747
DURATION — 30
END TIME — 747+ 30 = 777

But actually end time should be 13.15,
13.15 *60 — 789

Can someone suggest any method to tackle this situation?

  • 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-10T10:20:58+00:00Added an answer on June 10, 2026 at 10:20 am

    Using decimals to represent time makes life hard. Simply multiplying by 60 is not going to give an answer in hours and minutes. For example, consider: 0.02 * 60. As a decimal, that gives the value 1.20. However, that should be 2 minutes, not 1.20 minutes.

    You’ll probably need to split the fraction from the integer. Let’s consider 2.03 (2:03 AM). Multiply the integer by 60; that’s 120 minutes since midnight. Multiply the 0.03 by 60; that gives you 1.80; divide that by 0.60 (since 60 minutes are represented by the fraction 0.60)and you get 3, so the total time is 123 minutes since midnight. Of course, you could simply multiply the fraction by 100; that gives the same result. If you have I.F (meaning integer I and fraction F), you obtain the total number of minutes since midnight from (60 * I + 100 * F).

    Now suppose you have interval V too. This is an integer number of minutes.

    Given:

    • I = 12
    • F = 0.45
    • V = 30

    You want the value of I.F + V as a time.

    • M = 60 * I + 100 * F + V
    • M = 720 + 45 + 30
    • M = 795 since midnight

    To get back to the answer H.M, you need to divide M / 60 to get H, and you take the remainder M % 60 and divide by 100 to get the fraction:

    • H = 795 / 60 = 13
    • M = (795 % 60) / 100 = 15 / 100 = 0.15

    Hence, the answer is H + M = 13.15 or 13:15 PM.

    Yes, it is hard work. But that’s because the representation used is really not appropriate for the task at hand.

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

Sidebar

Related Questions

Here I have a simple php script which displays some values from a database
so in my database some rows have NULL values, and when I select *
I have some html stored in database . I dont know that html stored
I have some files stored in a database blob column in Oracle 9. I
I do have a loop which store data into mysql... /connect to your database
Which data type is used to store date time (not only date but also
I have a test database which logs data from when a store logs onto
I have some data in a database that I need represented in an XML
I have some information in my database like 'author', 'book' etc., that are all
i have some fields in my database table,and a field with phone name ,

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.