John Culkin
asked on
SQL and date fields
How do I return records from table with dates less than
or greater than mm/dd/yy
the min(dd/mm/yy) or max(dd/mm/yy)
don't seem to work
thanks
or greater than mm/dd/yy
the min(dd/mm/yy) or max(dd/mm/yy)
don't seem to work
thanks
ASKER
I don't want to find all dates greater than a certain date
I need to find the maximum date, ie the last date in a field.
by the way my sshortdate is ok.
many thanks
john
ps last(dd/mm/yy) doesnt seem to work either
I need to find the maximum date, ie the last date in a field.
by the way my sshortdate is ok.
many thanks
john
ps last(dd/mm/yy) doesnt seem to work either
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SQL's like:select max(tdate) from timesliporselect min(tdate) from timeslipor select min(tdate) from timeslipwhere tdate>'mm/dd/yy'really work. All you need is to construct SQL you need runtime.Let's say this way:QueryTimeslip.SQL.Clear;QueryTimeslip.SQL.Add('sel ect min(tdate) from timeslip');QueryTimeslip.SQL.Add('whe re tdate>'+DateToStr(someDate ));QueryTimeslip.Open;or you may use FormatDateTime('mm/dd/yy', someDate) instead of DateToStr(). This function is safer. Using DateToStr() you must sure that global variables shortDateFormat and DateSeparator are set to correct values.vyga
ASKER
sorry about the delay Ive been on holidayThanksJohn
Select * from table1 where table1.date>'dd/mm/yy'
The problem might be in the date format you have in your system.
You can use FormatDateTime function or you should check your
win.ini file and look for the [intl] section where the variable sShortDate must be the date format you need.
Regards,
Javi