SQL Recipes
A FREE cookbook for SQL queries and examples
Register FAQ Search Today's Posts Mark Forums Read

SQL - Questions and Answers Have a SQL question? Post it here. First do a search to see if someone hasn't already answered it.

Go Back   SQL Recipes a FREE cookbook of SQL queries and examples > SQL queries and examples > SQL - Questions and Answers

Reply
 
LinkBack Thread Tools Search this Thread
  #1 (permalink)  
Old 12-20-2006, 03:14 PM
Kut
 
Posts: n/a
Default MySQL dialect question:

How do I format mySQL date?


I have a forum and would like to run a query where I can get the member id, topic id and date that it was read. I am able to do this but the date comes out in an unreable 10 digit number. How do I run the query so it reads as a regular date>

Below, I am looking for topic id 5160 to see all the member ids who read it and the dates.

SELECT 5160, read_mid, read_date FROM ibf_topics_read
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

ANSWER(S):

  #2 (permalink)  
Old 12-20-2006, 06:20 PM
ben ben is offline
Administrator
 
Join Date: Mar 2007
Posts: 93
ben has disabled reputation
Default MySQL answer. Re: How do I format mySQL date?

I think your date is stored as a UNIX timestamp. MySQL has functions to convert this to 'normal' date formats. See http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html for more info.

SELECT  read_mid,  FROM_UNIXTIME(read_date) AS read_date FROM ibf_topics_read WHERE id = 5160
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do i create a query to extract all records within a given date. For instance beginning date and? Richard Amaning SQL - Questions and Answers 1 09-29-2006 06:23 AM
How to retrieve records which the date column should be 36 months older than the current date? lowie SQL - Questions and Answers 1 08-21-2006 03:39 AM


All times are GMT. The time now is 09:24 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0
Copyright (c) 2006-2008 SQL Recipes

1 2 3 4 5 6 7 8