Search code examples
asp.netdatems-access-2007

how to convert date in text field to UK date format of dd/mm/yyyy in ms access?


I want to display all dates greater than equal to today's date but the dates are stored in a text field.How to convert it into date format ? I tried :

    select columns from table where date >= format (DateTime.Today,"dd/mm/yyyy");

it returns the dates followed by all other dates in the table .

Also tried :

    DateSerial(CInt(Left(jobdate,2)),CInt(Mid(jobdate,3,2)),CInt(Right(jobdate,4))) which gives error.

Solution

  • You must convert your text date to true for any comparison to work.

    So (in Access):

    Select columns From table Where DateSerial(Mid(jobdate, 7, 4), Mid(jobdate, 4, 2), Mid(jobdate, 1, 2) >= Date()