Commits

Miki Tebeka committed b55ab88

%w

Comments (0)

Files changed (2)

 	%M - Minute as a decimal number [00,59]
 	%p - Locale’s equivalent of either AM or PM
 	%S - Second as a decimal number [00,61]
+	%w - Weekday as a decimal number
 	%x - Locale’s appropriate date representation
 	%X - Locale’s appropriate time representation
 	%y - Year without century as a decimal number [00,99]
 
 Missing directives:
 	%U - Week number of the year
-	%w - Weekday as a decimal number
 	%W - Week number of the year
 */
 package strftime
 	"time"
 )
 
+const (
+	Version = "0.1.1"
+)
+
 // See http://docs.python.org/2/library/time.html#time.strftime
 var conv = map[string]string{
 	"%a": "Mon",         // Locale’s abbreviated weekday name
 		start := time.Date(t.Year(), 1, 1, 0, 0, 0, 0, time.UTC)
 		day := int(t.Sub(start).Hours()/24) + 1
 		return fmt.Sprintf("%03d", day)
+	case "%w":
+		return fmt.Sprintf("%d", t.Weekday())
 	}
 
 	panic(fmt.Errorf("unknown directive - %s", match))
 		t.Fatalf("day of year != 314 (got %s)", s)
 	}
 }
+
+
+func TestWeekday(t *testing.T) {
+	s , err := Format("%w", testTime)
+	if err != nil {
+		t.Fatalf("error expanding %w", err)
+	}
+
+	if s != "2" {
+		t.Fatalf("day of week != 2 (got %s)", s)
+	}
+}