14. April 2021 19:40
IF (("Date next Export" <= WORKDATE) AND ("Time next Export" <= TIME)) THEN BEGIN .....
private static bool SummerTime()
{
DateTime dt = DateTime.Now;
bool Summertime = false;
//YEar to search/look
int year = dt.Year;
DateTime DateM = new DateTime();
DateTime DateOc = new DateTime();
DateTime date;
for (int i = 1; i <= 12; i++)
{
date = new DateTime(year, i, DateTime.DaysInMonth(year, i), System.Globalization.CultureInfo.CurrentCulture.Calendar);
int daysOffset = date.DayOfWeek - DayOfWeek.Sunday; // take the offset to subtract directly instead of looping
if (daysOffset < 0) daysOffset += 7; // if the code is negative, we need to normalize them
date = date.AddDays(-daysOffset); // now just add the days offset
if (i == 3)
{
//Last Sunday Sunday in March
DateM = date;
}
if (i == 10)
{
//Last Sunday Sunday in October
DateOc = date;
}
}
if ((dt > DateM) && (dt < DateOc))
Summertime = true;
else if (dt > DateOc)
Summertime = false;
else if (dt < DateM)
Summertime = false;
return Summertime;
}
14. April 2021 20:34
15. April 2021 15:38
15. April 2021 19:27
27. April 2021 19:34