Jump to content

Date


jteixeira

Recommended Posts

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

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...