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

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-10-30
  • 2022-02-18
  • 2021-11-20
  • 2021-11-05
  • 2021-11-13
  • 2022-03-05
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-12
  • 2022-02-23
  • 2022-12-23
相关资源
相似解决方案