浏览代码

DateTools.format examples (#5443)

Small examples to demonstrate how the syntax should look like.
Mark Knol 9 年之前
父节点
当前提交
09b8d505f9
共有 1 个文件被更改,包括 14 次插入0 次删除
  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))