DateTime.ParseExact method query [modified]
-
hi all, i need to know wht input will satisfy this condition DateTime tm=DateTime.ParseExact(sar[1],new String [] {"t","T"},CultureInfo.CurrentCulture,DateTimeStyles.AllowWhiteSpaces|DateTimeStyles.NoCurrentDateDefault); in this above sar[] wht should i pass in this below is my method which accepts DayofweekandTime as input. String [] sar=delay.Split(new char [] {' '}); if(sar.Length<2) return DateTime.MinValue; sar[0]=sar[0].Trim().ToUpper(); DateTime tm=DateTime.ParseExact(sar[1],new String [] {"t","T"},CultureInfo.CurrentCulture,DateTimeStyles.AllowWhiteSpaces|DateTimeStyles.NoCurrentDateDefault); tm=new DateTime(2003,1,6)+new TimeSpan(0,tm.Hour,tm.Minute,tm.Second,tm.Millisecond); for(int i=0; i<7; i++) { if(tm.ToString("ddd").ToUpper()==sar[0]) return tm; tm+=new TimeSpan(1,0,0,0); } return DateTime.MinValue; thanks in advance.... -- modified at 2:48 Friday 25th August, 2006
-
hi all, i need to know wht input will satisfy this condition DateTime tm=DateTime.ParseExact(sar[1],new String [] {"t","T"},CultureInfo.CurrentCulture,DateTimeStyles.AllowWhiteSpaces|DateTimeStyles.NoCurrentDateDefault); in this above sar[] wht should i pass in this below is my method which accepts DayofweekandTime as input. String [] sar=delay.Split(new char [] {' '}); if(sar.Length<2) return DateTime.MinValue; sar[0]=sar[0].Trim().ToUpper(); DateTime tm=DateTime.ParseExact(sar[1],new String [] {"t","T"},CultureInfo.CurrentCulture,DateTimeStyles.AllowWhiteSpaces|DateTimeStyles.NoCurrentDateDefault); tm=new DateTime(2003,1,6)+new TimeSpan(0,tm.Hour,tm.Minute,tm.Second,tm.Millisecond); for(int i=0; i<7; i++) { if(tm.ToString("ddd").ToUpper()==sar[0]) return tm; tm+=new TimeSpan(1,0,0,0); } return DateTime.MinValue; thanks in advance.... -- modified at 2:48 Friday 25th August, 2006