Google
 

Friday, September 14, 2007

แปลง timestamp

โจทย์ คือ pw_lastauth คือ timestamp นับจากปี 1/1/1970
เราใช้วิธีแปลง โดยใช้ from_unixtime ครอบ field นั้นอีกที

$query = "select field_A, from_unixtime(field_B_which_is_timestamp) as login_time from table_name where from_unixtime(field_B_which_is_timestamp) > '2006-12-31 23:59:59'";

เพียงเท่านี้ก็ได้เวลา ที่คนอย่างเราเข้าใจแล้ว

1 comment:

Anonymous said...

Hello. This post is likeable, and your blog is very interesting, congratulations :-). I will add in my blogroll =). If possible gives a last there on my blog, it is about the Estabilizador e Nobreak, I hope you enjoy. The address is http://estabilizador-e-nobreak.blogspot.com. A hug.