Forums: Rules on dates II - Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Rules on dates II Rules on dates II Rate Topic: -----

#1 User is offline   ijunior 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 6
  • Joined: 01-June 19

Posted 16 June 2019 - 01:36 AM

Good night

I want to thank you for the help in the previous issue, thank you very much. But now I have another question.

And with multiple dates? Example:

I have 3 dates,

Date 1, Date 2 and Date 3

Date 1 may be any date,
Date 2 can not be less than date 1 and
Data 3 may not be less than date 1 and not less than date 2.

Since date 3 will not always be filled in along with date 1 and date 2.

Can you help me?

Thankful.
0

#2 User is offline   jadach 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 467
  • Joined: 26-April 08
  • Gender:Male
  • Location:New York

Posted 16 June 2019 - 04:23 PM

Try this on before record added event

DateTime dt1 = DateTime.Parse(values["Date1"].ToString());
DateTime dt2 = DateTime.Parse(values["Date2"].ToString());
DateTime dt3 = DateTime.Parse(values["Date3"].ToString());

if (dt2.Date < dt1.Date)
{
message = "Date 2 can not be less than date 1";
return false;
}
else if (dt3.Date < dt1.Date)
{
message = "Date 3 can not be less than date 1";
return false;
}
else if (dt3.Date < dt2.Date)
{
message = "Date 3 can not be less than date 2";
return false;
}
else
{
return true;
}

-jerry
0

#3 User is offline   ijunior 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 6
  • Joined: 01-June 19

Posted 16 June 2019 - 07:51 PM

Good afternoon

Thank you for your help.

It worked when date 3 is filled, but when date 3 is blank an error occurs.
0

#4 User is offline   ijunior 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 6
  • Joined: 01-June 19

Posted 17 June 2019 - 01:55 AM

Data 3 if it is empty error occurs. And not without pre it will be fulfilled.
0

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users