Browse Source

Add getDay

Pascal Peridont 19 years ago
parent
commit
b871964e75
2 changed files with 6 additions and 0 deletions
  1. 1 0
      std/Date.hx
  2. 5 0
      std/neko/NekoDate__.hx

+ 1 - 0
std/Date.hx

@@ -47,6 +47,7 @@ extern class Date
 	function getFullYear() : Int;
 	function getMonth() : Int;
 	function getDate() : Int;
+	function getDay() : Int;
 
 	/**
 		Returns a string representation for the Date, by using the

+ 5 - 0
std/neko/NekoDate__.hx

@@ -61,6 +61,11 @@ class NekoDate__ //implements Date
 		return date_get_hour(__t).s;
 	}
 
+	public function getDay() : Int {
+		var d = Std.parseInt( new String(date_format(__t,untyped "%u".__s)) );
+		return if( d == 7 ) 0 else d;
+	}
+
 	public function toString():String {
 		return new String(date_format(__t,null));
 	}