interrupt Posted February 28, 2006 Share Posted February 28, 2006 Hello out there,I am trying to get the same data that I was getting from mysql through mssqlvery common mistake, i am surehere is the mysql query string that worked fine to get some data through php mysql functions $sql = "SELECT A.id, A.url, A.title, A.body, B.name, B.url as feedurl, DATE_FORMAT(A.dt, '%H:%i') as time, DATE_FORMAT(A.dt, '%W %D %M %Y') as date FROM lylina_items A, lylina_feeds B, lylina_userfeeds C WHERE B.id = A.feed_id AND B.id = C.feed_id AND C.user_id = $UID AND UNIX_TIMESTAMP(A.dt) > UNIX_TIMESTAMP()-($hours*60*60) ORDER BY A.dt DESC, A.title";here is my new attempt when using an MSSQL database through php ODBC functions:$sql = "SELECT A.id, A.url, A.title, A.body, B.name, B.url as feedurl, getdate(A.dt, 'H:i:s') as time, getdate(A.dt, 'Y-m-d') as date FROM lylina_items A, lylina_feeds B, lylina_userfeeds C WHERE B.id = A.feed_id AND B.id = C.feed_id AND C.user_id = $UID AND (A.dt) > CURRENT_TIMESTAMP()-($hours*60*60) ORDER BY A.dt DESC, A.title";I am getting an error that says getdate() takes 0 parameters. and with no parameters there is an error involving syntax near a period.. I am definitely lost in this stuff. Let me know if I am leaving out important things..I am looking for a way to get a formatted date through SQL grammar for an MSSQL databasethanks! Link to comment https://forums.phpfreaks.com/topic/3713-sql-dates/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.