File: week_date.dem

package info (click to toggle)
gnuplot 6.0.3%2Bdfsg1-1~exp2
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 14,960 kB
  • sloc: ansic: 95,874; cpp: 7,199; makefile: 2,470; javascript: 2,339; sh: 1,531; lisp: 664; perl: 304; pascal: 191; tcl: 88; python: 46
file content (39 lines) | stat: -rw-r--r-- 1,510 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#
# Show incorrect and corrected week number output for formats
# %W (ISO 8601 "week date") and %U (CDC/MMWR "epi week").
# Gnuplot versions through 5.4.1 produced incorrect output.
#
print "Contrast two different conventions for week dates"
print "Format %W is the Monday-based ISO 8601 week date."
print "Format %U is the Sunday-based CDC/MMWR 'epi week'."
print "   (both were incorrect prior to gnuplot 5.4.2)   "
print ""

print "        date   %a  %w  %d   %j  %W  %U"
print "  ===================================="


do for [d in "27 28 29 30 31"] {
    date = d.".12.2003"
    print "  ", date,  \
      strftime("  %a", (strptime("%d.%m.%Y", date))), \
      strftime("  %w",(strptime("%d.%m.%Y", date))), \
      strftime("  %d",(strptime("%d.%m.%Y", date))), \
      strftime("  %j",(strptime("%d.%m.%Y", date))), \
      strftime("  %W",(strptime("%d.%m.%Y", date))), \
      strftime("  %U",(strptime("%d.%m.%Y", date)))
    if (d eq "28") { print "              ISO 2004-W01      --" }
}

do for [d in "01 02 03 04 05 06 07 08 09 10 11 12 13"] {
    date = d.".01.2004"
    print "  ", date,  \
      strftime("  %a", (strptime("%d.%m.%Y", date))), \
      strftime("  %w",(strptime("%d.%m.%Y", date))), \
      strftime("  %d",(strptime("%d.%m.%Y", date))), \
      strftime("  %j",(strptime("%d.%m.%Y", date))), \
      strftime("  %W",(strptime("%d.%m.%Y", date))), \
      strftime("  %U",(strptime("%d.%m.%Y", date)))
    if (d eq "03") { print "               2004 epi week 1      --" }
}