Browse Source

some Date defines.

Nicolas Cannasse 19 years ago
parent
commit
bfd1c9e8a8
1 changed files with 21 additions and 0 deletions
  1. 21 0
      std/flash/Boot.hx

+ 21 - 0
std/flash/Boot.hx

@@ -231,6 +231,27 @@ class Boot {
 					}
 				}
 			};
+			Date.now = function() {
+				return new Date();
+			};
+			Date.prototype.toString = function() {
+				var m = this.getMonth() + 1;
+				var d = this.getDate();
+				var h = this.getHours();
+				var mi = this.getMinutes();
+				var s = this.getSeconds();
+				if( d < 10 )
+					d = "0" + d;
+				if( m < 10 )
+					m = "0" + m;
+				if( h < 10 )
+					h = "0" + h;
+				if( mi < 10 )
+					mi = "0" + mi;
+				if( s < 10 )
+					s = "0" + s;
+				return this.getFullYear()+"-"+m+"-"+d+" "+h+":"+mi+":"+s;
+			};
 
 			// copy base classes from root to flash package
 			// we can't make a loop since we need to assign short-type-ids