• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 354
  • Last Modified:

shift DateTime to beginning or ending of the day

I have a call i am making in a property set:

if(value > this.datePicker.MaxDate)

9 times out of ten, this works fine, however, occasionaly the MaxDate has slightly fewer ticks than the value.  

i want to totally disregard the time component of the DateTime ( though i need these objects to remain as DateTimes).  


ultimatley, i just want to make sure value is on the same day or before max date.


if I call (date)value > (date)this.datePicker.MaxDate, will that work?  If I call subtract, will that work correctly?
0
jjacksn
Asked:
jjacksn
1 Solution
 
sumixCommented:

 you have Date property of DateTime struct which excludes the Time part:

  if (value.Date > DateTime.MaxValue.Date) ...
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now