在PHP中格式化时间() [英] Formatting time() in PHP

查看:166
本文介绍了在PHP中格式化时间()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用一个数据库,在表格中,我有时间使用 time()

来保存数据库有没有任何格式化它以人类可读的方式(日期和时间)?

谢谢

解决方案

是的,您可以使用 date 功能。



<$ p $ echo date(F j,Y,g​​:ia,$ timestamp);

输出格式如下:

  // 2001年3月10日,下午5:16 


I'm using a database where in the table I have the time after it was saved using time()
Is there any way formatting it to human readable way (date and time)?

Thanks

解决方案

yes, you can use date function for that.

echo date("F j, Y, g:i a", $timestamp);

Output will be in following format:

// March 10, 2001, 5:16 pm

这篇关于在PHP中格式化时间()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆