MySQL Forums
Forum List  »  Knowledge Base

Storing time and search
Posted by: Aadlene Lexon
Date: July 03, 2009 01:18AM

Hi all,

I am creating database tables in MySql where I need to store time(date is not mandatory) and need to produce search results depending upon the input given using stored procedures. I would like to know the best way of storing "Time" in MySql database and also it should be
efficient when I am going for a search.

Below are 2 options which I thought it might work file. Please let me know if you guys have good suggestions related this.


1. storing just the time (i.e. 20:34) as varchar and trying to find the appropriate records by converting the actual time provided by the user
to varchar.

2. storing time as datetime(i.e. 2001-01-01 10:34:34 AM) and manipulating it to obtain time from it to compare it with the actual time provided
by the user.

Thanks

Options: ReplyQuote


Subject
Views
Written By
Posted
Storing time and search
3858
July 03, 2009 01:18AM
1750
September 03, 2009 03:00PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.