View unanswered posts | View active topics It is currently Mon May 23, 2022 12:10 am



Reply to topic  [ 2 posts ] 
 Mysql Date Format 
Author Message
Junior Member

Joined: Mon May 07, 2007 6:40 pm
Posts: 2
Post Mysql Date Format
Hi, im trying to get a date range Between anydate to anydate,

my date format is dd.mm.yyyy


this is the table

CREATE TABLE table (
id int(11) unsigned NOT NULL auto_increment,
custid varchar(11) NOT NULL default '',
note text NOT NULL,
date varchar(10) NOT NULL default '',
datefu varchar(10) NOT NULL default '',
PRIMARY KEY (id)
) TYPE = MyISAM;

is it basicly
SELECT * FROM $tablename WHERE datefu BETWEEN DATE $datefa AND DATE $datefb


Mon May 07, 2007 6:47 pm
Report this post
Profile
Junior Member

Joined: Mon May 07, 2007 6:40 pm
Posts: 2
Post 
Thanks For the quick reply,

um its not really and error to my understanding MySQL dosnt not like to search ranges by this date format dd.mm.yyyy

i have so far converted dd.mm.yyyy to yyyy-mm-dd

by

Code:
SELECT STR_TO_DATE(DATE,'%d/%m/%Y') as Mydate from table1;

But now i want to range it Say SELECT * FROM table1 WHERE Mydate BETWEEN $daterange1 AND $daterange2

so it only select the dates in that range

I have changed it to

Code:
select custid, date, str_to_date(date,'%d.%m.%Y') as datefu from custnotes WHERE datefu BETWEEN DATE '2007-03-01' AND DATE '2007-05-30';

but it says there are 0 entrys

am i doing somthing wrong ??


Mon May 07, 2007 10:20 pm
Report this post
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 2 posts ] 

Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
© Copyright 2003-2008 www.php-editors.com. The ultimate PHP Editor and PHP IDE site.