如何在PHP中获得给定日期或时间的格式?
如何在PHP中获得给定日期或时间的格式?
如果我给出这样的日期,
2022-03-08 06:45:06
它应该返回“ ymd H:i:s”
是否有可能从日期开始获取格式的方法?
How to get a format of the given date or time in php?
If I give date like this,
2022-03-08 06:45:06
It should return "Y-m-d H:i:s"
Is there any possible way to get the format from date?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不认为有这样的功能。
如果您需要处理不同格式的日期,请以时间戳重新格式化它们,然后以所需的格式
您可以尝试这样的操作
i dont think there is such a function.
if you need to handle dates in different formats, reformat them in timestamp and then in the needed format
you can try something like this