You should always use unambiguous date formats with databases - this means that the date will interpreted correctly regardless of which localisation you are running the program in.
There are two ways you can format the dates e.g.
var ab = utc.ToString("yyyyMMddTHH:00:00");
var ab1 = utc1.ToString("u");
The first line results in "ISO unseparated date format"
20160302T11:00:00
and the second is "ISO 8601 datestamp format"
2016-03-02 12:55:18Z
To be clear, both of those dates represent the date "2nd March 2016".
The simplest way to "take data between ab and ab1" is to use
SELECT * FROM demoData WHERE datum BETWEEN @ab and @ab1
which is the same as saying
SELECT * FROM demoData WHERE datum >= @ab AND datum <= @ab1
Depending on your exact requirement you might need to get rid of one of the equal signs
SELECT * FROM demoData WHERE datum >= @ab AND datum < @ab1
SELECT * FROM demoData WHERE datum > @ab AND datum <= @ab1
To run that query from C# use
Parameterised queries[
^] e.g.
var sql = "SELECT * FROM demoData WHERE datum BETWEEN @ab and @ab1";
var command = new SqlCommand(sql);
command.Parameters.AddWithValue("@ab", ab);
command.Parameters.AddWithValue("@ab1", ab1);
Apart from helping to protect your database from SQL Injection, it also takes care of the single-quotes that are required around dates in the WHERE clause.
Take heed of the comment from @RichardDeeming - make sure these columns are the correct type - do not store dates in (n)char or (n)varchar columns, use the
date
or
datetime
type.