User Tools

Site Tools


notes:csharp:datetime

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
notes:csharp:datetime [2016/09/07]
admin [Operations]
notes:csharp:datetime [2016/11/22] (current)
admin [Operations]
Line 111: Line 111:
 // Obtain the number of days in February. // Obtain the number of days in February.
 int daysInFebruary = DateTime.DaysInMonth(d.Year,​ 2); // 28 int daysInFebruary = DateTime.DaysInMonth(d.Year,​ 2); // 28
 +
 +// Obtain the current week number.
 +DateTimeFormatInfo info = DateTimeFormatInfo.CurrentInfo;​
 +Calendar cal = info.Calendar;​
 +int weekNumber = cal.GetWeekOfYear(DateTime.Now,​ info.CalendarWeekRule,​ info.FirstDayOfWeek);​
  
 // Add one hour and 15 minutes. // Add one hour and 15 minutes.
notes/csharp/datetime.txt ยท Last modified: 2016/11/22 by admin