月中第幾周的週幾演算法

2021-06-18 12:17:41 字數 361 閱讀 5229

計算乙個陽曆日期是哪月哪周周幾,並以指定格式輸出; 如:2023年5月12日是5月第二週週日是母親節;2023年6月16日是6月第三週週日是父親節;每年9月第三週周二是國際和平日,輸入2023年9月10日,輸出字串格式:5.2.0 6.3.0 9.3.2

private string 月中周(datetime 陽曆日期)

月週幾 += 第幾周.tostring("0|");

月週幾 += (convert.toint16(陽曆日期.dayofweek)).tostring("0");

月週幾 = 月週幾.replace("|", ".");

return 月週幾;

}

判斷當前時間是週幾,及本年的第幾周

import datetime import calendar 獲取當天日期值 currentdate datetime.date.today print currentdate year currentdate.year month currentdate.month day currentdat...

一年的第幾周怎麼算 求當天是本月的第幾周 ahk

在群裡遇到一的問題 求當天是本月的第幾周?用 解決。首先要確定 第幾周 的含義,有以下幾中 1 7號算第一周,其它類推 週日到週六算一周 周一到週日算一周。問題的複雜在於,用2 3的標準來算,還要看每月1號到週末的幾天,算不算一周?因為可能不滿7天。的標準是 4天以上算一周,3天以下不算。歸納如下 ...

獲取每年的第幾周集合

public class dateutil else if time.length 110 date date new date dateformat sdf new dateformat yyyy mm dd hh mm ss try catch exception e string last12...