| 
					
				 | 
			
			
				@@ -0,0 +1,45 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+package tyr 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	"time" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+// Time fmt 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+const ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	TimeFmtLong    = `2006-01-02 15:04:05` // yyyy-MM-dd hh:mm:ss 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	TimeFmtNumeric = `20060102150405`      // yyyyMMddhhmmss 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	DateFmtLong    = `2006-01-02` // yyyy-MM-dd 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	DateFmtNumeric = `20060102`   // yyyyMMdd 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+// IsTime 是否时间格式字符串 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+func IsTime(s string) bool { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	if _, err := time.Parse(TimeFmtLong, s); err != nil { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		return false 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	return true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+// Str2Time 字符串转时间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+func Str2Time(s string) (t time.Time, err error) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	t, err = time.Parse(TimeFmtLong, s) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+// StrFmtTime 时间转字符串 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+func StrFmtTime(s, fmt string) (t time.Time, err error) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	t, err = time.Parse(fmt, s) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+// Time2Str 时间转字符串 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+func Time2Str(t time.Time) string { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	return t.Format(TimeFmtLong) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+// TimeFmtStr 时间转字符串 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+func TimeFmtStr(t time.Time, fmt string) string { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	return t.Format(fmt) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} 
			 |