---
title: "Room + Date / Time"
url: https://daily.dev/posts/room-date-time-imorzexci
source_url: https://chrisbanes.me/posts/room-time
type: article
source: "Chris Banes"
published: 2026-07-05T07:13:56.212Z
updated: 2026-07-05T07:18:09.377Z
tags: ["sqlite"]
reading_time: 8
upvotes: 0
comments: 0
language: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Room + Date / Time

**[Chris Banes](https://daily.dev/sources/chrisbanes)** · 8 min read · 0 upvotes · 0 comments

## Summary

Android Room database does not natively support timezone-aware date/time storage. The canonical approach of mapping java.util.Date to Long loses timezone information. A better solution uses the ThreeTen-BP library's OffsetDateTime class with custom TypeConverters that serialize values as ISO 8601 strings (e.g., 2013-10-07T17:23:19.540-04:00) stored as SQLite TEXT. This preserves full timezone data. For correct chronological ordering in queries, SQLite's built-in datetime() function must be used instead of plain string sorting, since lexicographic ordering breaks when rows have different UTC offsets.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://chrisbanes.me/posts/room-time>

## Similar posts on daily.dev

- [10 best practices for timestamps and time zones in databases](https://daily.dev/posts/10-best-practices-for-timestamps-and-time-zones-in-databases-xhfzsegaw) · Tinybird · 1 upvotes · 0 comments
- [Migration of Android App from Java Time API to Kotlin Time](https://daily.dev/posts/migration-of-android-app-from-java-time-api-to-kotlin-time-7f9sg4uyl) · ProAndroidDev · 0 upvotes · 0 comments
- [British Columbia, Time Zones, and Postgres](https://daily.dev/posts/british-columbia-time-zones-and-postgres-uiebxsyyj) · Crunchy Data · 0 upvotes · 0 comments

---

Tags: [#sqlite](https://daily.dev/tags/sqlite)

[View this post on daily.dev](https://daily.dev/posts/room-date-time-imorzexci)
