jteixeira Posted February 15, 2007 Share Posted February 15, 2007 hi,i would like to know, how i select only the date of now? Link to comment Share on other sites More sharing options...
jesh Posted February 15, 2007 Share Posted February 15, 2007 This works in SQL Server: SELECT getdate() Link to comment Share on other sites More sharing options...
miffe Posted February 15, 2007 Share Posted February 15, 2007 This works in SQL Server:SELECT getdate() I prefer to use the interfase to solve that, if you are using php you might consider using time and date functions, or like ways in any other language such as perl, asp, java, js, etc... and just insert the date into a datetime field in mysql or whatever DB system you might be using. Link to comment Share on other sites More sharing options...
jesh Posted February 15, 2007 Share Posted February 15, 2007 To each his/her own. I typically use the DB to generate dates because our application currently runs on multiple web servers and a single DB server. If I were to get the date off of one of the web servers, it could be slightly different than a date on one of the other web servers whereas if I get it off the DB server, all dates/times will be according to the same clock for all records.But, either way works. Link to comment Share on other sites More sharing options...
jteixeira Posted February 16, 2007 Author Share Posted February 16, 2007 i only want the date for example ''16-02-2007" Link to comment Share on other sites More sharing options...
jesh Posted February 16, 2007 Share Posted February 16, 2007 On SQL Server (T-SQL), you can use something like this: SELECT CONVERT(datetime, getdate(), 105); See http://doc.ddart.net/mssql/sql70/ca-co_1.htm for more info.On MySQL, it looks like you can use something like this: SELECT DATE_FORMAT(NOW(), '%d-%m-%Y'); See http://dev.mysql.com/doc/refman/5.0/en/dat...-functions.html for more info. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now