PHP

    mktime - 날짜를 타임스탬프 값으로 변환
    • 조회수 698
    • 작성일 2018-08-17
    •  
    mktime — Get Unix timestamp for a date

    int mktime ([ int $hour = date("H") [, int $minute = date("i") [, int $second = date("s") [, int $month = date("n") [, int $day = date("j") [, int $year = date("Y") [, int $is_dst = -1 ]]]]]]] )


    [ 사용 예 ]

    $lyj_1 = "2016-12-22 16:19:02";
    $lyj_2 = explode(" ", $lyj_1);
    $lyj_3 = explode("-",$lyj_2[0]);
    $lyj_4 = explode(":",$lyj_2[1]);


    $str = mktime($lyj_4[0],$lyj_4[1],$lyj_4[2],$lyj_3[1],$lyj_3[2],$lyj_3[0]);

    echo $str;
    // 1482391142
    echo "<br/><br/><br/>";

    $times = date("Y-m-d H:i:s", $str);

    echo $times;