How to calculate today is the first week of this year.

zhaozj2021-02-16  42

Written by Cesar

2002.7.23 (correction)

Regarding the algorithm, there is no serious consideration. It is ok. I don't know if it is correct. I hope everyone will correct. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ----------------------------------------- Returns a string value.

Public string weekofyear () {// first take the year's year String Year = Convert.toString (DateTime.today.year); // Conversion this year's first day DateTime firstofyear = datetime.parse ("01 01" year); // The first day of the year is the day INT firstofweek = Convert.Toint32 (firsttofyear.dayofweek); // Today is this year's days the first day of the year is the day of the week, then except 7. Return Convert.toString ((DateTime) . Today.dayofyear firstofweek 6) / 7);

转载请注明原文地址:https://www.9cbs.com/read-26229.html

New Post(0)