private static string TimeToQuarterString(string time) { DateTime t = DateHelper.ToDateTime(time); string Y = time.Substring(0, 4); int y = Convert.ToInt32(Y); if (t.CompareTo(new DateTime(y, 1, 1)) >= 0 && t.CompareTo(new DateTime(y, 3, 31)) <= 0) return Y + "年第一季度"; else if (t.CompareTo(new DateTime(y, 4, 1)) >= 0 && t.CompareTo(new DateTime(y, 6, 30)) <= 0) return Y + "年第二季度"; else if (t.CompareTo(new DateTime(y, 7, 1)) >= 0 && t.CompareTo(new DateTime(y, 9, 30)) <= 0) return Y + "年第三季度"; else if (t.CompareTo(new DateTime(y, 10, 1)) >= 0 && t.CompareTo(new DateTime(y, 12, 31)) <= 0) return Y + "年第四季度"; else return ""; } |
|
来自: woshishenxian... > 《c#》