I wrote a program about testing time legitimacy

zhaozj2021-02-16  71

/// Time Check, judgment the legality of the input time

///

///

///

///

///

Private Bool Checkdate (int year, int month, int day)

{

IF (Year.toString ()! = "&& month.tostring ()! =" "&& day.tostring ()! =" "

{

Try

{

IF (Month> 12 || MONTH <1)

{

This.Popupwin_Message.Visible = true;

This.Popupwin_Message.title = "Information Tips";

This.Popupwin_Message.Message = "If you fill in, please refill it!"

This.popupwin_Message.Text = "You are incorrect, please re-fill it!"

Return false;} if ((Month == 1 || Month == 3 || Month == 5 || Month == 7 || Month == 8 || Month == 10 || Month == 12) && Day> 31 || Day <1)) {this.popupwin_message.visible = true; this.popupwin_message.title = "Information Tips"; this.popupwin_Message.Message = "If you fill in, please re-fill it!" "This.popupwin_message.text =" You are incorrect, please re-fill it! "

Return false;} if ((MONTH == 4 || Month == 6 || Month == 9 || Month == 11) && (day> 30 || day <1)) {this.popupwin_message.visible = true This.popupwin_message.title = "Information Tips"; this.popupwin_Message.Message = "If you fill in, please re-fill it!"; This.popupwin_message.text = "You fill in the time is incorrect, please re-re- fill in!";

Return false;}

IF (Month == 2) {if (DAY <1) {this.popupwin_message.visible = true; this.popupwin_message.title = "Information Tips"; this.popupwin_message.Message = "Your time you fill in, please Re-filled! "; This.popupwin_message.text =" If you are filled in, please re-fill it! "; Return False;}

IF (DateTime.isleApyear (Year)) {if (DAY> 29) {this.popupwin_message.visible = true; this.popupwin_message.title = "Information Tips"; this.popupwin_message.Message = "You fill in the time is incorrect Please re-filled it! "; This.popupwin_message.text =" If you are filled in, please refill it! "

Return false;}} else {if (day> 28) {this.popupwin_message.visible = true; this.popupwin_message.title = "Information prompt"; this.popupwin_message.Message = "You fill in the time, please re- Fill in! "; This.popupwin_message.text =" If you fill in, please re-fill it! ";

Return false;}}} return true;} catch (exception e) {e.tostring (); return false;}} else {return false;}}

转载请注明原文地址:https://www.9cbs.com/read-15145.html

New Post(0)