TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
How to get the start and end times of a day
Arulraj Aboorvasamy
Mar 02
2015
Code
8.6
k
0
1
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
var dates =
new
string
[2];
dates[0] = DateTime.Today.AddTicks(1).ToString(CultureInfo.InvariantCulture);
dates[1] = DateTime.Today.AddDays(1).AddTicks(-2).ToString(CultureInfo.InvariantCulture);
var startDate = DateTime.Parse(dates[0]).Date;
var endDate = DateTime.Parse(dates[1]).Date.AddDays(1).AddTicks(-1);
var oneDayTime = endDate - startDate;
Note: Getting the Date object is important here
Date time
filtering
one day time
start and end times of a day