6fa7faa5创建于 2025年10月24日历史提交

Date and Time Formatting

Use Cases

The date and time formats vary according to countries and cultures. The difference lies in such aspects as the sequence of year, month, and day in a date and the separator of hour, minute, and second in the time. If your application needs to display the date and time, ensure that the information is displayed in line with local user habits for easy understanding.

Time and date formatting includes date and time formatting, relative time formatting, and time segment formatting. Date and time formatting means to convert the date and time into a string in the specified format. Relative time formatting means to convert the time difference between a time point and another time point to the specified format, for example, 30 seconds ago or 1 day later. Time segment formatting means to convert a time segment to the specified format, for example, Wednesday or 8:00-11:30.

How to Develop

Date and Time Formatting

For details about how to format the date and time, see Intl.DateTimeFormat.

Relative Time Formatting

For details about how to format the relative time, see format.

Time Range Formatting

For details about how to format the time range, see formatRange.