我的文字日期价值如此" 1986-04-24 18:25:14"
我不需要显示时间,我怎么才能阅读日期? "第一个有价值的词#34;
代码:
<?php
$id = ((int)$_POST["id"]);
$con=mysql_connect('localhost','dbuser','pass');
mysql_query("set names utf8");
mysql_query("set charset utf8");
mysql_set_charset('utf8');
mysql_select_db('dbname',$con);
$query="SELECT * FROM `haevm_userxtd_profiles` WHERE user_id = '$id' AND `key` = 'BASIC_BIRTHDAY' ORDER BY `haevm_userxtd_profiles`.`user_id` ASC LIMIT 0 , 30";
$select=mysql_query($query);
while($row=mysql_fetch_array($select)){
echo $row['value'];
}
mysql_close($con);
?>
注意:我已尝试使用SUBSTRING,但我冷静地选择了这样的内容:
SELECT value, SUBSTRING(value,0,1) FROM `haevm_userxtd_profiles` WHERE user_id = '$id' AND `key` = 'BASIC_BIRTHDAY' ORDER BY `haevm_userxtd_profiles`.`user_id` ASC LIMIT 0 , 30
谢谢
答案 0 :(得分:1)
试试这个
SELECT value, DATE(value) FROM `haevm_userxtd_profiles` WHERE user_id = '$id' AND `key` = 'BASIC_BIRTHDAY' ORDER BY `haevm_userxtd_profiles`.`user_id` ASC LIMIT 0 , 30