Skip to main content

Posts

Showing posts with the label time comparison code

compare To Current Time in asp.net

compare To Current Time in asp.net public static bool compareToCurrentTime(string time) { time = convert12To24(time); int hr = DateTime.Now.Hour; int min = DateTime.Now.Minute; string current = ((hr < 10) ? "0" : "") + hr + ":" + ((min < 10) ? "0" : "") + min; if (time.CompareTo(current) >= 0) { return true; } else return false; }