I currently have a date in the format
20/10开发者_JAVA百科/2000 2:2:02
I need this date to be in "Linux Time" so that I can use it with other functions.
Unfortunately, I cannot change the format the date is saved as.
How can I convert this to Linux Time?
The PHP function "strtotime" takes a date in a string format (exactly what you have in the database) and converts it to epoch time (which you've referred to as linux time)
An example
<?php
$time = '20-10-2000 2:2:02';
var_dump(strtotime($time));
Outputs
int(972003722)
strtotime() uses american dates (MM/DD/YY) if you use /'s and English dates (DD/MM/YY) if you use dashes - so for you you'd need
<?php
$time = str_replace('/', '-', '20/10/2000 2:2:02');
var_dump(strtotime($time));
精彩评论