sqlite - How to filter SQL by time (greater and less than)? -
I want to query a subset from a dataset. Each line has one time stamp of the following format:
2014-04-25T17: 25: 14 2014-04-25T18: 40: 16 2014 -04-25 T18: 44: 57 2014-04-25T19: 10: 32 2014-04-25T20: 22: 12 ...
Currently, I use the following query A time-based subset for:
time '% 2014-04-25T18%' or '% 2014-04-25T19%' like the time '
It becomes quite complicated when you start filtration by mintutes or seconds.
Is there a way to run a query such as ...
time & gt; '% 2014-04-25T18%' and time & lt; '% 2014-04-25T19%' '
A regular expression will also be fine.
The database is one. The time column is of VARCHAR type.
If the date is considered as a string and the example given above:
Time '% 2014-04-25T18%' & Time & lt; & Gt; Otherwise, you can change the date in seconds after midnight and add up to 60 minutes so that the range portion of the filter Declaration @test DATETIME = '2014-04-25T17: 25: 14' Select Taste, convert (Date, @test) as JUSTDATE, DATAFIFF (S, CONVERT (DATETIME , (Convert (DATE, @Test)), AS SECONDSMEDARD - 60 seconds * 60 minutes * 24 hours = 86400
Comments
Post a Comment