首页 > 其他 > 详细

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

时间:2017-07-28 20:48:06      阅读:341      评论:0      收藏:0      [点我收藏+]

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

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!