Wintergreen
Wintergreen

Reputation: 234

MySQL date format is not supported

When we call this procedure

Call get_reports_by_time('2014-12-22 11:19:26 AM').

no data is returned

but when we call this

Call get_reports_by_time('2014-12-22 11:19:26 ')

all the records for that day is returned. why its so?

Upvotes: 0

Views: 88

Answers (1)

road242
road242

Reputation: 2532

string representation of dates/timestamps,... is dependent on your db settings.

In your case one representation can be converted to a date (assuming that you work with a date type in your stored procedure) and one representation cannot be converted to a date.

I higly suggest to use date and time types and not any string representation for your paremeters (if you need a string representation then convert it by YOURSELF using date/str_to_date)

Upvotes: 1

Related Questions