Date Time as a document field to create views

My timezone is -4:00.

Here is a sample date in a document:
2014-10-23T17:06:38.1980646-04:00

Output of emit( dateToArray(doc.date)); is [ 2014, 10, 23, 21, 6, 38 ]

Note 21 in the output where it has been converted to GMT time. If I
want to query all data earlier than 2014-10-23T17:06:38.1980646-04:00,
do I need to write query with GMT converted time ?

Do I write this …

?startkey= [ 2014, 10, 23, 21, 6, 38 ]&descending=true

or this

[ 2014, 10, 23, 17, 6, 38 ]
Thanks

1 Like

UTC is the default and yes you do need to query with the UTC times as well. However if you use dataToArray for the startkey and you have your timezone in the datetime, it will auto convert to UTC for you.
thanks

Thanks. Got it.

So, the conversion is either way and no need to query with converted time as far as timezone is included in date.