Convert MMDDYYYY to date for PHP

前端 未结 6 752
你的背包
你的背包 2021-01-14 10:46

I have a string with a date which is in this format MMDDYYYY (ie. 01132012, 01142012 etc.)

I need to do something on a page, if that string is 14 days or less from t

6条回答
  •  梦谈多话
    2021-01-14 11:30

    try "preg_match(pattern,string on wich the pattern will be aplied)"; http://www.php.net/manual/en/function.preg-match.php you can also define an offset. so first take te first 2 digits. than take the other 2 digits and after that get the other four digits. after that place them in one string. after that use maketime,strtotime,date. this kind of stupid solution but i only thought of that. hope this will help

提交回复
热议问题