Problem with datetime

Hi,

I want to search a record that have create the 19/07/2006 (today)
I stock in ‘date_creation’ type DATETIME , this date.

But when I do a search I can’t find this record.

My code is:
forms.find_record.controller.find();
date_creation = utils.dateFormat(globals.date_enter,‘dd/MM/yyyy’)+‘|dd/MM/yyyy’;
forms.find_record.controller.search();

this code work only when I Add “<=” or “>=” front of methode ‘utils.dateFormat’.

I have no error when I execute this code.
‘globals.date_enter’ is a datetime too.

Kinds regards,

a datetime does have a time part, which does not seems the be 00:00:00 in your case, use the “#” to match all times in a day.

If two people in two different timezones enter the same date, won’t they have different time parts, like:

July 21, 2006 12:00:00 AM EDT
July 21, 2006 12:00:00 AM CDT

If so, then won’t sorting be affected, or am I misunderstanding datetime fields?

Datetimes are stored as GMT in the db, sorting is done based on that.
The timezone you see is formatted (and converted from GMT) based on your OS settings

Hi Jan,

I think my last post was confusing.

I realize that datetimes are stored in GMT. So, if someone in Amsterdam and New York both enter today’s date in a datetime field, you might have:
Mon Jul 24 2006 00:00:00 GMT+0200 (not sure if that’s the right offset)
Mon Jul 24 2006 00:00:00 GMT-0400

These will sort differently, right? So, it might be better off to just use a date field and not a datetime field?

Regards,
Sean

no, the database stores all dates in GMT+0 … this means infact they are timezone independent

Hi Jan,

Thanks for the clarification. I was hoping I was wrong :wink:

Regards,
Sean