I inherited a database that stores the times as 900 for 9:00am and 1500 for 3:00pm. How can I convert these numbers to normal time formats in PHP?
1条回答 默认 最新
- duandao6414 2014-11-23 02:30关注
Use the PHP
mktime()
function. So you would do something like this:$hour = substr($time, 0, -2); // Get everything before last two chars of string $minute = substr($time, -2); // Gets last two chars of string $newtime = mktime($hour, $minute);
Then use PHP
date()
to format it how you want.本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报
悬赏问题
- ¥15 matlab实现基于主成分变换的图像融合。
- ¥15 对于相关问题的求解与代码
- ¥15 ubuntu子系统密码忘记
- ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
- ¥15 保护模式-系统加载-段寄存器
- ¥15 电脑桌面设定一个区域禁止鼠标操作
- ¥15 求NPF226060磁芯的详细资料
- ¥15 使用R语言marginaleffects包进行边际效应图绘制
- ¥20 usb设备兼容性问题
- ¥15 错误(10048): “调用exui内部功能”库命令的参数“参数4”不能接受空数据。怎么解决啊