PHP Statement Date Comparison related issues

Source: Internet
Author: User
PHP Statement Date comparison problem
How to compare the size of two dates startdate and enddate in this page form when submitting a page, and make a judgment.
Is there a date function that can be converted to a type that can compare size regardless of what type date is?
Write with the PHP statement, I will not JS with Ajax, thank you!

------Solution--------------------
PHP Code
  1, ' Feb ' = 2, ' Mar ' = 3, ' Apr ' = 4, ' May ' + 5, ' June ' and ' 6 ', ' July ' and 7 ', ' Sept ' + 8, ' Oct ' =& Gt , ' Nov ' +-one, ' Dec ', ' + '; $m = substr ($date, 0, Strpos ($date, '/')); $good = Str_replace ($m, $mon [$m], $date);//Return Time stamp for shaping return strtotime ($good);} $date 1 = "apr/13/2012"; $date 2 = "apr/6/2012";//April 13 is larger than April 16, resulting in Truevar_dump (GetTime ($date 1) > GetTime ($date 2));
------Solution--------------------
C + + code
[User:liangdong time:13:54:44 path:~/php]$ php date.php 2012/7/2[user:liangdong time:13:54:46 Path:~/php]$ cat date.php
    
------Solution--------------------
PHP code
cat:cat:no such file or directory!--? phpfunction s                                Tr_to_time ($str _date) {$mon _name = array ("Jan", "Feb", "Mar", "APR", "may", "June", "July", "Sept"        "," Nov "," Dec ");        $mon _index = range (1, 12);        $str _date = Str_replace ($mon _name, $mon _index, $str _date); Return @strtotime ($str _date);} Echo str_to_time ("2012/JULY/2");? --> 
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.