blob: 73333963135b8a71e34cc1b9a4f27bd843eeab79 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
|
import std/[times, os, strutils, strbasics, strscans, sets, re, tables], parseopt
proc getWeekNumber(date: DateTime): int =
return int((date.monthDay - 1) / 7) + 1
proc getWeekNumberFromEnd(date: DateTime): int =
let daysInMonth = getDaysInMonth(date.month, date.year)
let day = date.monthday
return int((daysInMonth - day) / 7) + 1
var d = now() - 21.days
echo getWeekNumber(d)
|