2017-07-19 27 views
0

我從日期得到非常奇怪的數據,我只是不明白爲什麼?!?角度不轉換unix日期,因爲它應該

<b>{{ (lines.date*1000) | date:"dd-mm-yyyy" }}: </b> 

這裏是我的線陣列中的數據:

"lines" : [ 
     { 
      "text" : "was CREATED Tue Jul 11 2017 from Booking.com: ThaiHome by ThaiHome Staff", 
      "date" : 1499754031 
     }, 
     { 
      "date" : 1499754031, 
      "text" : "wrote message: This is the message the NEW user writes to manager" 
     }, 
     { 
      "date" : 1499754140, 
      "text" : "wrote message: This is the message the NEW user writes to manager" 
     }, 
     { 
      "date" : 1499754140, 
      "text" : "wrote message: This is the message the NEW user writes to manager" 
     }, 

這裏是輸出

11-20-2017: was CREATED Tue Jul 11 2017 from Booking.com: ThaiHome by ThaiHome Staff 
11-20-2017: wrote message: This is the message the NEW user writes to manager 
11-22-2017: wrote message: This is the message the NEW user writes to manager 
11-22-2017: wrote message: This is the message the NEW user writes to manager 
11-22-2017: wrote message: This is the message the NEW user writes to manager 
11-24-2017: wrote message: This is the message the NEW user writes to manager 
11-24-2017: wrote message: This is the message the NEW user writes to manager 
11-24-2017: wrote message: This is the message the NEW user writes to manager 

爲什麼會出現這些奇怪的日期,而不是越來越平常實際日期?

回答

3

mm用於分鐘,填充(00-59)。對於一個月,你可以使用下面的一個:

  • MMMM:本月年(一月至十二月)
  • MMM:本月年(一月至十二月)
  • MM:本月以來,填充( 01-12)
  • M:本月年(1-12)

Official reference

+0

Noooo真的嗎?哈哈哈該死! - 我一直在爲這個問題出汗一個小時,試圖用數學哈哈解決它。我需要更好地看看它接受的令牌:-)感謝Prera​​k :-D – torbenrudgaard

+0

樂意幫忙:) –

+0

https://docs.angularjs.org/api/ng/filter/date - 它們都是:-D – torbenrudgaard