Posted By

stavelin on 09/11/08


sql php textmate unix function query timestamp fromunixtime

Versions (?)

from_unixtime sql

 / Published in: PHP

  1. public function listAllMyPublishedArticles($uid) {
  2. $query="SELECT article_tbl.aid,header,introduction,body,published_state, FROM_UNIXTIME(published_date, '%d/%m/%y %H:%i') as published_date FROM article_tbl, user_has_art_tbl WHERE user_has_art_tbl.uid= $uid AND user_has_art_tbl.aid = article_tbl.aid AND article_tbl.published_state = 1 ORDER BY aid desc";
  3. $query=mysql_query($query)or die(mysql_error());
  4. return $query;
  5. }

Report this snippet  


RSS Icon Subscribe to comments
Posted By: stavelin on September 11, 2008

the "FROMUNIXTIME(publisheddate, '%d/%m/%y %H:%i') as published_date" is what I wanted to save, and remember.

I always store dates as unix timestamp, somehow I feel this give me more flexibility, but I guess that's just me..

You need to login to post a comment.