Page 1 of 1

query for timestamp

Posted: Wed Mar 09, 2005 1:06 am
by nhan
how can i query for selecting timestamp? example my timestamp field is :
20050309145502

how can i search for the specific date only if my query is the exact date traditionally my syntax is :
select * from timein where timestamp = 20050309145502;

i have to select the first 8 digits only... can anyone help me....

thanks!

Posted: Wed Mar 09, 2005 1:09 am
by feyd
I already told you how to do this in the other thread. :|

query for timestamp

Posted: Wed Mar 09, 2005 1:32 am
by nhan
thanks feyd, im sorry for these stupid questions...
i tried this one but it doesnt display the record, i really dont know the term its called, but i have d idea in my mind....

i just want to query all records having the date only... the timestamps include the time, so when i query the results are zero...

select * from tbl where timestamp = 'date_format(20050309)';

thanks so much!

Posted: Wed Mar 09, 2005 1:35 am
by feyd
you'll need date_format() on the timestamp, not the input date you are trying against (provided you supply in a form that is compatible with the date_format() output... You may want to research how date_format() works.. http://dev.mysql.com/doc/mysql/en/date- ... tions.html

Posted: Wed Mar 09, 2005 7:04 pm
by nhan
thanks so much sir feyd!

i saw some link on the internet and this is also possible solution for my problem....

:)

select * from tbl where data3 like '03-09-05%';

i never thought that using "like" would be possible... thanks for your help!

regards,

nhan