The datetime is not stored in the format "May 7, 2018, 11:33 a.m." in the database. It is returned formatted in that way by some function used to query the databse.
SQLite knows three different formats to specify dates and times:
TEXT as ISO8601 strings ("YYYY-MM-DD HH:MM:SS.SSS").
REAL as Julian day numbers, the number of days since noon in Greenwich on November 24, 4714 B.C. according to the proleptic Gregorian calendar.
INTEGER as Unix Time, the number of seconds since 1970-01-01 00:00:00 UTC.
So you have to use one of these formats (probably the TEXT format in your case). There are also helper functions to format dates:
SQLite Query Language: Date And Time Functions[
^].
Your posted dates are already in the ISO 8601 format. So your code should work without modifications.