Forums

This topic is locked

MYSQL Timestamp problem

Posted 06 May 2004 23:35:39
1
has voted
06 May 2004 23:35:39 James Kemp posted:
Am using Dreamweaver MX 2004, MYSQl & PHP. Have a column in my Database that assigns a Timesatmp. This cannot be converted to a readable date in Dreamweaver. I've heard that you need to convert this to a Unix Timesatmp. How can this be done from my current SQL Query below:

SELECT *
FROM 'myTable'
WHERE ID = colname

Notice that this is a query on a Detail Page. I have a Date field that I need converting from a Mysql Timestamp to display some kind of readable date. I am rather new to dreamweaver and web development so please be gentle with me and fully explain any replies (thanks!)

Note: I origianlly thought that adding the following SQL statement to the above query would work - but it doesn't:
SELECT UNIX_TIMESTAMP(date) AS Date
FROM 'mytable'

Replies

Replied 07 May 2004 00:52:49
07 May 2004 00:52:49 Matt Machell replied:
go to this page:

dev.mysql.com/doc/mysql/en/Date_and_time_functions.html

and check out the date_format function. It does what I think you're asking for.

-Matt

DMX Zone Premium Content Author
Replied 07 May 2004 20:03:18
07 May 2004 20:03:18 James Kemp replied:
Thanks for reply but this is not the answer. You can't actually amend the Timestamp format from within your table in MYSQL. What I need is a an SQL query that will convert the date to a UNIX_Timestamp (see my original post). I will then be able to display the date however I want in dreamweaver.

Reply to this topic