CodePlexProject Hosting for Open Source Software
An unexpected error has occured.
There is an unsaved comment in progress. You will lose your changes if you continue. Are you sure you want to reopen the work item?
Voted
No files are attached
bbell2000 wrote Mar 19, 2011 at 3:12 PM
# The 2006-to-max rules can be expressed more simply as # Rule Jordan 2002 max - Mar lastThu 24:00 1:00 S # The rules below avoid use of 24:00 through 2051 # (which TimeZone.Parse cant handle). Rule Jordan 2002 2004 - Mar lastFri 0:00 1:00 S Rule Jordan 2003 only - Oct 24 0:00s 0 - Rule Jordan 2004 only - Oct 15 0:00s 0 - Rule Jordan 2005 only - Apr 1 0:00 1:00 S Rule Jordan 2005 only - Sep lastFri 0:00s 0 - Rule Jordan 2006 2010 - Mar lastFri 0:00 1:00 S Rule Jordan 2006 max - Oct lastFri 0:00s 0 - Rule Jordan 2011 only - Apr 1 0:00 1:00 S Rule Jordan 2012 2015 - Mar lastFri 0:00 1:00 S Rule Jordan 2016 only - Apr 1 0:00 1:00 S Rule Jordan 2017 2021 - Mar lastFri 0:00 1:00 S Rule Jordan 2022 only - Apr 1 0:00 1:00 S Rule Jordan 2023 2032 - Mar lastFri 0:00 1:00 S Rule Jordan 2033 only - Apr 1 0:00 1:00 S Rule Jordan 2034 2038 - Mar lastFri 0:00 1:00 S Rule Jordan 2039 only - Apr 1 0:00 1:00 S Rule Jordan 2040 2043 - Mar lastFri 0:00 1:00 S Rule Jordan 2044 only - Apr 1 0:00 1:00 S Rule Jordan 2045 2049 - Mar lastFri 0:00 1:00 S Rule Jordan 2050 only - Apr 1 0:00 1:00 S Rule Jordan 2051 max - Mar lastFri 0:00 1:00 S
public static bool TryParseTimeSpan(string timeSpan, TimeSpanAssumption noColonAssumption, out TimeSpan result) { if (timeSpan != null && timeSpan[0] == '+') { timeSpan = timeSpan.Substring(1); } timeSpan = ParseTimeSpanAssumptions(timeSpan, noColonAssumption); if (!TimeSpan.TryParse(timeSpan, out result)) { timeSpan = timeSpan.Replace("24:00", "1.00:00"); return TimeSpan.TryParse(timeSpan, out result); } return true; } public static TimeSpan ParseTimeSpan(string timeSpan, TimeSpanAssumption noColonAssumption) { if (timeSpan != null && timeSpan[0] == '+') { timeSpan = timeSpan.Substring(1); } timeSpan = ParseTimeSpanAssumptions(timeSpan, noColonAssumption); TimeSpan result; if (!TimeSpan.TryParse(timeSpan, out result)) { timeSpan = timeSpan.Replace("24:00", "1.00:00"); result = TimeSpan.Parse(timeSpan); } return result; }
mlmanfredi wrote Mar 23, 2011 at 3:24 PM
Sign in to add a comment or to set email notifications
Keyboard shortcuts are available for this page.