Hi
Pls suggest me the best possible way to accept date from user . Date should not be less than Server Date
Thanks
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Praneeth KumarRank #4,422 · 344 reputationPosted Jun 9, 2011, 9:02 AM EDT
P.S:I would always advice client side validation.
Regards,
Praneeth
Jiteendra SampathiraoRank #585 · 4.1K reputationPosted Jun 9, 2011, 10:37 AM EDT
write the functionality.....in the code behind........
apply the auto postback property to the control where u are offering date from user...
In the control related event write the datetime difference function......
Refer this link:
http://www.homeandlearn.co.uk/csharp/csharp_s14p1.html
Check the download link: for validation and all....
Modify below code to your requirement:
protected void Page_Load(object sender, EventArgs e)
{
// Declare and get DateTime values
DateTime StartDate = System.DateTime.Now;
DateTime EndDate = System.DateTime.UtcNow;
// Find time difference between two dates
TimeSpan TimeDifference = StartDate - EndDate;
// Write difference in hours and minutes
Response.Write("Time difference between server time and Coordinated Universal Time (UTC) is " +
TimeDifference.Hours.ToString() + " hours ");
if (TimeDifference.Minutes != 0)
Response.Write(" and " + TimeDifference.Minutes.ToString() + " minutes.");
}
tony rich9 reputationPosted Jun 18, 2011, 10:49 AM EDT