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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T01:45:29+00:00 2026-05-25T01:45:29+00:00

I have database where data is stored along timestamp entries, that are keys. i

  • 0

I have database where data is stored along timestamp entries, that are keys.

i need a function that can transform a date like DateTime.Now into a timestamp interval representing, for today as example, Aug 30th 00:00:00h to Aug 30th 23:59:59h.

How could i write that function?

What i want is to do something like

select all from table where timestamp is between a and b.(those and b values would represent the initial and terminal timestamps for a day.)

I did not create the db, i cannot modify it, i can only query it.

  • 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-25T01:45:30+00:00Added an answer on May 25, 2026 at 1:45 am

    This will return a tuple representing the interval you probably want:

    Tuple<DateTime,DateTime> GetDateInterval(DateTime datetime) {
        var start = datetime.Date;
        var end = start.AddDays(1).AddTicks(-1);
        return new Tuple<DateTime, DateTime>(start, end);
    }
    

    Usage:

    var interval = GetDateInterval(DateTime.Now);
    Console.WriteLine(interval.Item1);
    Console.WriteLine(interval.Item2);
    

    Output:

    30.08.2011 0:00:00
    30.08.2011 23:59:59
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have data stored as below in an MS Access database: Date User 20090101
I have a database which contains picture data stored as a binary blob. The
I have the following scenario: I have various user's data stored in my database.
I have a Database that contains data about articles , structures and manufacturers .
I have a database that contains data for many clients. Currently, we insert tens
I have a database full of customer data. It's so big that it's really
We have a database that persist our metadata and data. Our metadata is produced
I have a database that has lots of data and is all neat, normalized
I have a database with existing data, where previously I've been using AUTO_INCREMENT on
I have a database designed to hold card data from various trading card games.

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.