Thursday

start of the week C#

     
public static class DateTimeExtensions
{
public static DateTime StartOfWeek(this DateTime dt, DayOfWeek startOfWeek)
{
int diff = dt.DayOfWeek - startOfWeek;
if (diff < 0)
{
diff += 7;
}

return dt.AddDays(-1 * diff).Date;
}
}

Usage:
     
dateFrom.Value = DateTime.Now.StartOfWeek(DayOfWeek.Sunday);

No comments:

imagemagic add text to image

rem different types of text annotations on existing images rem cyan yellow orange gold rem -gravity SouthWest rem draw text and anno...