您的位置:首页 > Web前端 > React

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

2017-07-28 20:01 2626 查看
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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: