Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

将 Unix 时间戳转换为 Date 对象, 支持 10 位和 13 位长度 #19

Closed
wants to merge 3 commits into from

Conversation

penn201500
Copy link
Contributor

@penn201500 penn201500 commented Jul 30, 2024

Timestamp 转换成 Date:

image

/ * 
 * @example
 * // 示例: 有效的秒级时间戳
 * console.log(timestampToDate(1704067200)); // 输出: Date 对象,代表 2024-01-01 00:00:00 UTC
 *
 * @example
 * // 示例: 有效的毫秒级时间戳
 * console.log(timestampToDate(1704067200000)); // 输出: Date 对象,代表 2024-01-01 00:00:00 UTC
 *
 * @example
 * // 示例: 无效的时间戳
 * console.log(timestampToDate("invalid")); // 输出: null
 */

Copy link
Owner

@chenbimo chenbimo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

你好,感谢分享,请按照readme.md中的说明调整一下文件组织方式和命名风格,还有导出格式,谢谢~

@penn201500 penn201500 closed this Jul 31, 2024
@penn201500 penn201500 deleted the tsToDate branch August 3, 2024 09:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants