Last active
December 29, 2016 10:17
-
-
Save relyky/8f462e6c3a7ac997be78 to your computer and use it in GitHub Desktop.
Angular JS - dateFormat
This file contains hidden or 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
# 可引用 $filter 處理 | |
# ref → https://docs.angularjs.org/api/ng/filter/date | |
// 日期格式處理 | |
$scope.checkTimeFmt = $filter('date')($scope.checkTime, 'yyyy/MM/dd HH:mm:ss'); | |
// 等同在html | |
{{checkTime | date:'yyyy/MM/dd HH:mm:ss' }} | |
//------------------- | |
# 日期格式轉換 | |
$scope.ASSIGN_DT = new Date($scope.ASSIGN_DT).dateFormat("Y/m/d"); | |
# 格式 年/月/日 時:分 | |
new Date().dateFormat("Y/m/d h:i"), // yyyy/MM/dd HH:mm |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment