简体   繁体   English

如何将日期转换为数据库时间戳格式?

[英]How to Convert Date to Database timestamp format?

Good day, I am collecting data from different website using puppeteer, But the main problem is I am getting different kind of date format from different website like some website gives "6 days", some website gives "yesterday" some websites gives "15th August" like that.美好的一天,我正在使用 puppeteer 从不同的网站收集数据,但主要问题是我从不同的网站得到不同类型的日期格式,比如一些网站给出“6 天”,一些网站给出“昨天”,一些网站给出“8 月 15 日” “ 像那样。 But I need to convert it to Timestamp format "2021-04-13T17:43:08.016+00:00" like that in javascript.但我需要将其转换为时间戳格式“2021-04-13T17:43:08.016+00:00”,就像 javascript 中那样。 Any Idea how can I do that?任何想法我该怎么做? I have been googled but have not found any solution.我已经用谷歌搜索但没有找到任何解决方案。

I would recommend a library such as https://github.com/wanasit/chrono , this would parse human readable dates.我会推荐一个库,例如https://github.com/wanait/chrono ,这将解析人类可读的日期。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM