BigQuery compare Date

Viewed 37113

In BigQuery table what I using some date stored in DateTime typed columns with value like "2016-01-20T00:00:00". I want to run query that for example show row which included in some range (lets say from 2016-01-01 to 2016-02-28).

So problem is that when I put

...Where data < TIMESTAMP('2017-01-30 00:00:00')...//less then

it show me nothing but when I change it to opposite value like

...Where data > TIMESTAMP('2017-01-30 00:00:00')...//greater then

it returns me even those values that logically should be excluded (like 2017-01-20)

I have tested that TIMESTAMP('2017-01-20 00:00:00') returning '2017-01-26 00:00:00 UTC'.

So which method from bigQuery DateTime I should use to be able to compare dates that I have? May be I need to convert both of them into some kind 'milliseconds since' value?

Thanks

2 Answers
Related