dqwr32867 2012-02-28 11:48
浏览 56

将德国日期转换为Y-m-d不起作用?

I have a date like this: 2. Februar 2012

I want to have it converted to 2012-02-02, so I wrote this code:

$date = '2. Februar 2012';
$date = date('Y-m-d', $date);

The $date var is either empty or 1970-01-01 afterwards, whats wrong or missing?

Note: The date is in German format, so its not February, its Februar. I get the date from a date picker that way.

Thanks!

  • 写回答

5条回答 默认 最新

  • drj14664 2012-02-28 11:51
    关注

    use strtotime

    putenv('LC_ALL=de_DE');
    putenv('LANG=de'); 
    setlocale(LC_ALL, 'de_DE@euro', 'de_DE', 'deu_deu');
    
    $date = '2. Februar 2012';
    $date = date('Y-m-d', strtotime($date));
    
    评论

报告相同问题?

悬赏问题

  • ¥17 pro*C预编译“闪回查询”报错SCN不能识别
  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向