Created
June 25, 2020 05:56
-
-
Save ezaurum/1a1e9db21c1ad24ef7e04deb789bacf1 to your computer and use it in GitHub Desktop.
시간 예제
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"time" | |
) | |
func main() { | |
t := time.Now() | |
if t.Hour() > 12 { | |
fmt.Println(t.Format("2006년 1월 2일 오후 3시 4분 5초 ")) | |
} else { | |
fmt.Println(t.Format("2006년 1월 2일 오전 3시 4분 5초 ")) | |
} | |
t2 := t.Add(-time.Hour * 12) | |
if t2.Hour() > 12 { | |
fmt.Println(t2.Format("2006년 1월 2일 오후 3시 4분 5초 ")) | |
} else { | |
fmt.Println(t2.Format("2006년 1월 2일 오전 3시 4분 5초 ")) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
의문이 풀렸습니다 감사합니다!