[React Intl] Format Date and Time Using react-intl FormattedDate and FormattedTime
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