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
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Stuart Fraser
NA
10
1.7k
Check if date.now goes into New year
Sep 3 2013 9:27 AM
Hi. I am working on an app where staff holidays run from 01 August current year - July 31st following year.
I have a gridview which display all their booked holidays and a total of days booked in the footer. I am using the paramters below to pass into my SQL query
DateTime startdate = new DateTime(DateTime.Now.Year , 08, 01);
DateTime enddate = new DateTime(DateTime.Now.Year, 07, 31).AddYears(1);
But of course as soon as we pass midnight at new year that will not work so I need some conditional check, but how to do it?. I was thinking somthing like the below might work? but I am sure there is a much better way.
DateTime NewYear = new DateTime(DateTime.Now.Year , 01, 01)
if (datetime.now >= newyear)
{
years should be reversed i.e startdate = addyears(-1) end date = Datetime.now.year
}
else
{
no change needed
}
Reply
Answers (
2
)
i want to bind more than 5000 nodes
return value of sql querry