Skip to content

Instantly share code, notes, and snippets.

@yutannihilation
Last active December 9, 2019 09:47
Show Gist options
  • Save yutannihilation/ef6be481b9ceb5547573d6a8422df254 to your computer and use it in GitHub Desktop.
Save yutannihilation/ef6be481b9ceb5547573d6a8422df254 to your computer and use it in GitHub Desktop.

It seems we need to wait ARROW-3543 for preserving timezones.

library(arrow)
#> 
#> Attaching package: 'arrow'
#> The following object is masked from 'package:utils':
#> 
#>     timestamp

jst <- lubridate::now()
utc <- lubridate::with_tz(jst, "UTC")
d <- tibble::tibble(jst = jst, utc = utc)

d
#> # A tibble: 1 x 2
#>   jst                 utc                
#>   <dttm>              <dttm>             
#> 1 2019-12-09 18:46:18 2019-12-09 09:46:18

tmp <- tempfile()

write_parquet(d, tmp)

d <- read_parquet(tmp)

d$jst
#> [1] "2019-12-09 18:46:18 JST"
d$utc
#> [1] "2019-12-09 18:46:18 JST"

Created on 2019-12-09 by the reprex package (v0.3.0)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment