dougu1896 2013-10-22 10:09
浏览 7
已采纳

如何使用PHP以相反的顺序显示日期?

Just need a little help here. How can I display the date output of PHP in reverse order? For example if I have a date like this.

$date = date("Y-m-d"); //example output 2013-01-01

My expected output should be: 130-210-10 //01-01-2013

How can i do that?
  • 写回答

4条回答 默认 最新

  • douci1851 2013-10-22 10:13
    关注

    If you can change the order of parameters in date():

    echo strrev(date('d-m-Y'));
    

    If you can't change the order of the parameters in date():

    echo implode('-', array_map('strrev', explode('-', $date)));
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥15 制裁名单20240508芯片厂商
  • ¥20 易康econgnition精度验证
  • ¥15 msix packaging tool打包问题
  • ¥28 微信小程序开发页面布局没问题,真机调试的时候页面布局就乱了
  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致