DC Martin
DC Martin

Reputation: 41

IBM Cloud dashDB Timezone

The IBM Cloud (former Bluemix) dashDB service uses UTC as timezone. You cannot change that setting as far as I know. My data is from a different timezone.

How do I either set the timezone for my data (table or column) or structure/format my data such that dashDB will properly compare my values? (e.g. matching "today")

Upvotes: 1

Views: 703

Answers (3)

data_henrik
data_henrik

Reputation: 17176

dashDB has functions like TO_UTC_TIMESTAMP and FROM_UTC_TIMESTAMP to convert between UTC and a specific timezone. The following query returns the current time for Los Angeles/San Francisco:

SELECT from_utc_timestamp (current timestamp, 'America/Los_Angeles')
from sysibm.sysdummy1

If you wrap a date around you get the current date (a.k.a. "today") for that specific timezone:

SELECT date(from_utc_timestamp (current timestamp, 'America/Los_Angeles'))
from sysibm.sysdummy1

There are many functions to help with date/time arithmetics and you can add/subtract years/months/.../seconds from any date/time value. My recommendation would be to store timestamps that have been converted to UTC and go from there.

Upvotes: 1

DC Martin
DC Martin

Reputation: 41

The answer is "no support for timezone in time data." And stackoverflow is stupid to insist that an answer must be 30 characters or more. No means no.

Upvotes: 1

Kiran
Kiran

Reputation: 46

Check the dashDB Knowledge center on different options you can explore w.r.t timezone.

https://www.ibm.com/support/knowledgecenter/search/timezone?scope=SS6NHC

Upvotes: 0

Related Questions