Browse Source

DateTools.format examples (#5443)

Small examples to demonstrate how the syntax should look like.
Mark Knol 9 years ago
parent
commit
09b8d505f9
1 changed files with 14 additions and 0 deletions
  1. 14 0
      std/DateTools.hx

+ 14 - 0
std/DateTools.hx

@@ -112,6 +112,20 @@ class DateTools {
 		support in Flash and JS for day and months names (due to lack of proper
 		support in Flash and JS for day and months names (due to lack of proper
 		internationalization API). On Haxe/Neko/Windows, some formats are not
 		internationalization API). On Haxe/Neko/Windows, some formats are not
 		supported.
 		supported.
+
+		```haxe
+		var t = DateTools.format(Date.now(), "%Y-%m-%d_%H:%M:%S"); 
+		// 2016-07-08_14:44:05
+
+		var t = DateTools.format(Date.now(), "%r"); 
+		// 02:44:05 PM
+
+		var t = DateTools.format(Date.now(), "%T"); 
+		// 14:44:05
+
+		var t = DateTools.format(Date.now(), "%F"); 
+		// 2016-07-08
+		```
 	**/
 	**/
 	public static function format( d : Date, f : String ) : String {
 	public static function format( d : Date, f : String ) : String {
 		#if (neko && !(macro || interp))
 		#if (neko && !(macro || interp))