aboutsummaryrefslogtreecommitdiff
path: root/test.nim
diff options
context:
space:
mode:
Diffstat (limited to 'test.nim')
-rw-r--r--test.nim12
1 files changed, 12 insertions, 0 deletions
diff --git a/test.nim b/test.nim
new file mode 100644
index 0000000..7333396
--- /dev/null
+++ b/test.nim
@@ -0,0 +1,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)