Jump to content

Date format function


vchris
 Share

Recommended Posts

Can't you just substitute "CURRENT_TIMESTAMP" for the name of the column which stores the date?Rather than:

SELECT TIME(CURRENT_TIMESTAMP);

Use something like:

SELECT TIME(creation_date);

Link to comment
Share on other sites

DBMS = DataBase Management System (e.g. MySQL, MSSQL, MS Access).What about

SELECT MONTHNAME(date_field) AS month, DAYOFMONTH(date_field) AS date, YEAR(date_field) AS year FROM table

where date_field is of type DATE. Then you could use PHP to further format it.

Link to comment
Share on other sites

[Macromedia][sqlServer JDBC Driver][sqlServer]'MONTHNAME' is not a recognized function name.SQL:SELECT NPRI_ID, Comp_Name, Faci_Name, ProgramRef, MONTHNAME(closure) AS month, DAYOFMONTH(closure) AS date, YEAR(closure) AS year FROM QM3_Facility WHERE NPRI_ID LIKE '%06067' AND ReportYear = '2006'

Link to comment
Share on other sites

convert(date,closure,107) AS closureType date is not a defined system type.convert(varchar,closure,107) AS closureWorks but does not display correct style (2006.07.00). There seems to be a 00 value for the day. Can this query work with this 00 value?

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
 Share

×
×
  • Create New...