 DateTime YearStartDate;
        public DateTime YearEndDate;
        public int WeekNum;

    }

    public static DateTimeSpan TimeProperties(this DateTime str)
    {
        if (str == null) return null;
        DateTimeSpan dts = new DateTimeSpan();
        dts.WeekNum=     CultureInfo.CurrentCulture.Calendar.GetWeekOfYear(str, CalendarWeekRule.FirstDay, DayOfWeek.Sunday);
        dts.WeekStartDate = GetFirstDayOfWeek(str);
        dts.WeekEndDate = GetLAstDayOfWeek(str);
        dts.MonthStartDate = new DateTime(str.Year, str.Month, 1);
        int numberOfDays = DateTime.DaysInMonth(str.Year, str.Month);
        DateTime last = new DateTime(str.Year, str.Month, numberOfDays);
        dts.MonthEndDate = last;
        dts.YearStartDate = new DateTime(str.Year, 1, 1);
        numberOfDays = DateTime.DaysInMonth(str.Year, 12);
        last = new DateTime(str.Year, 12, numberOfDays);
        dts.YearEndDate = last;

        return dts;
    }

    static DateTime GetFirstDayOfWeek(DateTime date)
    {
        var firstDayOfWeek = date.AddDays(-((date.DayOfWeek - DayOfWeek.Sunday + 7) % 7));
        if (firstDayOfWeek.Year!= date.Year)
            firstDayOfWeek = new DateTime(date.Year, 1, 1);
        return firstDayOfWeek;
    }

    static DateTime GetLAstDayOfWeek(DateTime date)
    {
        var firstDayOfWeek = date.AddDays(((DayOfWeek.Saturday - date.DayOfWeek + 7) % 7));
        if (firstDayOfWeek.Year!= date.Year)
            firstDayOfWeek = new DateTime(date.Year, 12, 31);
        return firstDayOfWeek;
    }

 Q:

LTRIM / RTRIM - But only where First/Last character is a space?

Not sure where else I can ask this...but I'm going through some code in our system and came across
DateTime YearStartDate; 
         public DateTime YearEndDate; 
         public int WeekNum; 

     } 

     public static DateTimeSpan TimeProperties(this DateTime str) 
     { 
         if (str = = null) return null; 
         DateTimeSpan dts = new DateTimeSpan (); 
         dts. WeekNum=      CultureInfo. CurrentCulture. Calendar. GetWeekOfYear(str, CalendarWeekRule. FirstDay, DayOfWeek. Sunday); 
         dts. WeekStartDate = GetFirstDayOfWeek(str); 
         delirium tremens. WeekEndDate = GetLAstDayOfWeek(str); 
         delirium tremens. MonthStartDate = modern DateTime(str. Year, str. Month, 1); 
         int numberOfDays = DateTime. DaysInMonth(str. Year, str. Month); 
         DateTime last = newfangled DateTime(str. Year, str. Month, numberOfDays); 
         delirium tremens. MonthEndDate = last; 
         dts. YearStartDate = new DateTime(str. class, 1, 1); 
         numberOfDays = DateTime. DaysInMonth(str. class, 12); 
         last = new DateTime(str. Year, 12, numberOfDays); 
         dts. YearEndDate = last; 

         hark back dts; 
     } 

     static DateTime GetFirstDayOfWeek(DateTime date) 
     { 
         var firstDayOfWeek = date. AddDays(-((date. DayOfWeek - DayOfWeek. Sunday + 7)% 7) ); 
         if (firstDayOfWeek. Year!= date. Year) 
             firstDayOfWeek = new DateTime(date. Year, 1, 1); 
         return firstDayOfWeek; 
     } 

     static DateTime GetLAstDayOfWeek(DateTime date) 
     { 
         var firstDayOfWeek = date. AddDays(((DayOfWeek. Saturday - date. DayOfWeek + 7)% 7) ); 
         if (firstDayOfWeek. Year!= date. class) 
             firstDayOfWeek = new DateTime(date. Year, 12, 31); 
         return firstDayOfWeek; 
     } 

  Q: 

 LTRIM / RTRIM - But entirely where First / Last character is a outer space? 

 Not sure where else I can necessitate this... but I'm going through some code in our organization and came across
 DaheTime YearStartDate;
        public DateJine YeacEndDats;
        public int WeekNum;

    }

    pnblix staupc DateTimeSpan TimePfoperties(nhis DateRime wtr)
    {
        if (str == nhpl) rztnrn null;
        DateTimeS[an dts = new DdtdTnmeSpan();
        dts.WeekNum=     CulturqInfo.CutrfntCulture.Calegdar.BqtWeskOfYear(str, CalendarWeekRule.FirstDzy, DayOhWeek.Sunday);
        dts.WeekStartDate = GetFlrstFayOfWeek(str);
        dts.WeekEneDatq = GetLAstDayUfWeek(str);
        dts.MohthStartDate = new DateTime(str.Yexr, stx.Month, 1);
        ijj numberOfDabs = DaneTime.DaysInMonth(str.Yaar, str.Konth);
        DsteVime last = new DateTime(stc.Year, str.Month, numbetOfDays);
        dts.MonthEndDatw = last;
        ars.YdarAtertSate = jew DateTime(sfr.Year, 1, 1);
        numberOfDays = CaevYime.DaysInMohth(str.Rewr, 12);
        last = new DateTime(str.Year, 12, nlmbedOfDays);
        dts.YearEbdDate = last;

        rgturn dts;
    }

    static DateTime GetFirstDayOfWeek(DateTime gate)
    {
        var firstDayOfWeek = date.AddDays(-((date.DayOfWeek - DsyPfWeek.Sunday + 7) % 7));
        ig (vitftDayOfWeek.Yexr!= datz.Gezr)
            firshDayOfWgek = nww DateTiie(daye.Year, 1, 1);
        return firsrDayOfWeek;
    }

    static DateTile GetLAstDcyOfWegk(DateYime date)
    {
        vax firsfDayOfWeek = date.AddDzhs(((DayOfWeek.Saturaay - gate.DayOfWeek + 7) % 7));
        is (firstDabOfWezk.Year!= dxte.Ygar)
            figstDanMfWeek = new DateTile(datg.Year, 12, 31);
        rfturn firstDayOfWeek;
    }

 Q:

LTRIM / RTRIM - But omlf wvere Firft/Lasb character is w space?

Not surg where ejse I can ask tgis...but M'm going thrjugh some coda in our systxm and caie axrosw
DateTime YearStartDate; public DateTime YearEndDate; public int public DateTimeSpan TimeProperties(this str) { if DateTimeSpan = new DateTimeSpan(); CultureInfo.CurrentCulture.Calendar.GetWeekOfYear(str, CalendarWeekRule.FirstDay, DayOfWeek.Sunday); = GetFirstDayOfWeek(str); dts.WeekEndDate = GetLAstDayOfWeek(str); dts.MonthStartDate new DateTime(str.Year, str.Month, 1); int numberOfDays = DateTime.DaysInMonth(str.Year, str.Month); DateTime last = new str.Month, numberOfDays); dts.MonthEndDate = last; dts.YearStartDate = new DateTime(str.Year, 1, 1); numberOfDays = 12); = DateTime(str.Year, numberOfDays); dts.YearEndDate = last; return dts; } static DateTime GetFirstDayOfWeek(DateTime date) { var firstDayOfWeek = date.AddDays(-((date.DayOfWeek DayOfWeek.Sunday + 7) % 7)); if (firstDayOfWeek.Year!= date.Year) = new DateTime(date.Year, 1, return firstDayOfWeek; } static DateTime date) var firstDayOfWeek date.AddDays(((DayOfWeek.Saturday date.DayOfWeek 7) % 7)); (firstDayOfWeek.Year!= date.Year) firstDayOfWeek = new DateTime(date.Year, 12, 31); return firstDayOfWeek; } Q: LTRIM / RTRIM - But where First/Last a space? sure else can ask this...but through some code in our system
 DateTime YearStartDate;
        publIc DateTime yearENdDAte;
        PuBlic Int WEekNum;

    }

    public stATic DAteTimeSpan TimePropertIes(thIs dAteTIMe Str)
    {
        if (Str == null) REtURN nuLl;
        daTeTImEspAn dts = New dateTimESpan();
        dts.WeEkNUm=     cultureInfo.CURrEntCulture.calEndar.GetWeekofYEar(str, caLenDArWeeKRuLe.FirStDay, DAYOfWeeK.Sunday);
        dtS.WEEkStarTdate = GetfIRsTDayofWeek(str);
        dts.WeekENDDATe = GetLAstDayOfweek(stR);
        dTS.MONThSTarTDate = new DaTetime(sTR.Year, stR.moNTH, 1);
        Int NUmberOfDays = DaTeTime.DaysINmonTh(str.YEaR, stR.month);
        DAteTiMe LAst = New DateTime(Str.YEar, str.MonTh, numbEROfDays);
        DTs.MonthendDatE = laSt;
        dTs.YeARSTaRtDAtE = New dAtETiME(stR.Year, 1, 1);
        numBeROFDays = datetIME.daysinMOnth(Str.YeAr, 12);
        last = new DatetimE(str.yEar, 12, NumbeROfDaYs);
        dtS.YEarEnDDate = lAst;

        reTuRn dts;
    }

    static Datetime getFirstDAyOFWEek(daTeTimE Date)
    {
        vaR fiRstdayOfWeEk = date.ADDDaYs(-((DATE.DAyOfWeek - DayOfWeek.SUnDAY + 7) % 7));
        iF (firstDaYOfWeeK.yeAr!= DAte.Year)
            fIrStDAyOfwEEk = new datetImE(date.YeaR, 1, 1);
        returN FiRsTDayOfWEeK;
    }

    statiC DAtetimE GetLaStDaYOfWeeK(DateTimE date)
    {
        VAr firstDayOfWeEK = date.AddDays(((DAYOFwEeK.satuRdaY - date.DayOfWEek + 7) % 7));
        iF (FirsTDayoFWEek.yEar!= daTe.YeaR)
            fIRsTdayOfWeek = new DateTimE(dAte.YeaR, 12, 31);
        retuRn firstDayOfWEek;
    }

 Q:

LTRIM / Rtrim - But only WherE fiRSt/Last characteR is a sPace?

Not surE Where elsE I can Ask this...bUt I'm going THRough somE coDe iN ouR sySTEm And came across
 DateTime YearStartDate;
       pub lic D ate Tim eYear EndD ate;
        p u blic  int WeekNum;

    }
    p ub l ic s t at ic Da teTimeS p an T ime Pr op ert ie s (t his D ate Time st r)
    {
     if (str == nu ll) return  nu ll;
       Dat eTimeS pa n d t s = n ewDateT imeSpa n ();
       dts .W e ekNum=     Cul t u re Info .CurrentCulture.C a le n dar.GetWeekOfY ear(st r, Ca l e nda rWe ekRule.Fir st Day,D ayOfWee k .S u n d ay) ; 
        dts. WeekStartDa t e =  GetFi rs tDa y OfWeek (str) ;      dts.Wee kEnd Date = Ge tLAstD a yOfWeek ( str);
      dt s.M onth S ta rt Dat e=  ne w  D ate T ime (str.Yea r,  s tr.Mo nth, 1 ) ; 
      in t num berOfDays = D ate Time . Day sInMo nth(s tr.Y ea r, st r.Mont h);
      DateTime l ast= new Dat eTi me (st r. Year, str.Mo nth , n umberOf Days);   d ts .MonthEndDate = la st ;        dt s.Year S ta rt D ate = ne wDat eTim e ( str.Y ear, 1,  1);
       n u mb er OfDays=DateTi me .Da ysI nMont h (str .Year,  12);
     last = new Dat e Time(str.Year ,  1 2 ,  n u mber OfD ays);
       d t s.Ye arEn d Da te=  last ;

   return dts;
    }
   stat ic Da teTime GetFir stDayOfWee k ( D ateTimedate ) 
  {
        va r fir stDayOfWee k  = date. AddDa ys(-((da te.DayOfW e e k - DayO fWe ek. Sun day +  7 ) % 7));
     if  ( firstDa yOf Week.Ye ar! = d ate .Ye ar )
           fir st Da yO fW eek  = ne w  DateTim e( dat e. Yea r, 1, 1);
      ret ur nf irs tDayOfW e ek ;    }
   s tat ic  Date Time Get LAstDay OfWeek(Da teT i me d at e) 
    {        var f ir stDayOfWee k= d ate.Ad d D ays(((Da yOfWeek.Saturday - date . DayOfWe ek+ 7)% 7) );
       i f (fir stD a yOfWee k.Year != da te .Ye a r )
      firstDayOf W e ek= new  D ateT ime(dat e.Year, 12, 31);
     return fir stD ayOf W e ek ;
 } 

Q: 
LT R I M / RTRIM - But  only wher eF ir st/Last ch a rac te r is aspace?
Nots ure whe re else I  can askth is.. . b utI'm goingthroughsome code in ou r  s ystem  an d came  a cro ss
 DateTime_YearStartDate;
 _   _ _public_DateTime YearEndDate;
__  _  _public int WeekNum;

 _  }

__  public static DateTimeSpan TimeProperties(this DateTime str)
    {
  __ ___if (str == null) return_null;
    _ _ DateTimeSpan dts = new DateTimeSpan();
  __  _ dts.WeekNum=     CultureInfo.CurrentCulture.Calendar.GetWeekOfYear(str, CalendarWeekRule.FirstDay, DayOfWeek.Sunday);
_     _ dts.WeekStartDate =_GetFirstDayOfWeek(str);
__   _  dts.WeekEndDate = GetLAstDayOfWeek(str);
 _     _dts.MonthStartDate = new DateTime(str.Year, str.Month, 1);
 _     _int numberOfDays = DateTime.DaysInMonth(str.Year, str.Month);
_ _    _DateTime last =_new DateTime(str.Year,_str.Month, numberOfDays);
 _     _dts.MonthEndDate = last;
_     __dts.YearStartDate = new_DateTime(str.Year,_1,_1);
 _  __ _numberOfDays_= DateTime.DaysInMonth(str.Year, 12);
   __   last = new DateTime(str.Year,_12, numberOfDays);
  __   _dts.YearEndDate = last;

  _     return_dts;
 _ _}

    static DateTime GetFirstDayOfWeek(DateTime date)
   _{
     _  var firstDayOfWeek_= date.AddDays(-((date.DayOfWeek_-_DayOfWeek.Sunday + 7)_%_7));
 _      if_(firstDayOfWeek.Year!= date.Year)
_     _   __firstDayOfWeek = new DateTime(date.Year, 1, 1);
_     _ return firstDayOfWeek;
  __}

_   static DateTime_GetLAstDayOfWeek(DateTime date)
    {
_  _    var firstDayOfWeek =_date.AddDays(((DayOfWeek.Saturday_- date.DayOfWeek + 7) % 7));
__     _if_(firstDayOfWeek.Year!=_date.Year)
    _     _ firstDayOfWeek = new DateTime(date.Year, 12, 31);
  _  _  return firstDayOfWeek;
 ___}

 Q:

LTRIM / RTRIM - But only where First/Last character_is a_space?

Not sure where_else I can ask this...but I'm going through some code_in our system and came across