码迷,mamicode.com
首页 > 其他好文 > 详细

[React Intl] Format Date and Time Using react-intl FormattedDate and FormattedTime

时间:2017-07-28 20:58:13      阅读:205      评论:0      收藏:0      [点我收藏+]

标签:one   str   pre   mon   into   isp   and   ted   att   

Using the react-intl FormattedDate and FormattedTime components, we’ll render a JavaScript Date into both a date string and a time string in different language formats.,

 

FormattedDate and FormattedTime, they are similar, just FormattedTime contains both time and date.

<div>
                {
                  /**
                  
                    <FormattedDate value={new Date(review.date)}
                      year=‘2-digit‘
                      month=‘2-digit‘
                      day=‘2-digit‘ />
                   */
                }
                <FormattedTime 
                  year=‘2-digit‘
                  month=‘2-digit‘
                  day=‘2-digit‘
                  value={new Date(review.date)} />
</div>

 

Display as such:

04/20/17, 9:16 AM

 

[React Intl] Format Date and Time Using react-intl FormattedDate and FormattedTime

标签:one   str   pre   mon   into   isp   and   ted   att   

原文地址:http://www.cnblogs.com/Answer1215/p/7252381.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!