-1

I want to convert the following JD time format to its intuitively interpretable military format ("%H:%M:%S"):

Julian Day time format

Is there a function in R to do this? Any suggestions on how to convert to the desired military time format ("%H:%M:%S")?

Gub97
  • 3
  • 1
  • Could you please share your data using `dput`? – Quinten Jul 08 '22 at 11:12
  • convert the time to seconds by multiplying by 24hr*3600 seconds and then convert to a datetime object `as.POSIXct(t*24*3600, origin="2022-07-08")`, now format to desired output. – Dave2e Jul 08 '22 at 11:34
  • @Quinten `c(0.388025231484789, 0.388718518515816, 0.389415509256651, 0.390111689812329, 0.390806828705536, 0.392295023149927)` – Gub97 Jul 08 '22 at 12:09

1 Answers1

0

Maybe you want something like this (thanks to @Dave2e):

your_julian <- c(0.388025231484789, 0.388718518515816, 0.389415509256651, 0.390111689812329, 0.390806828705536, 0.392295023149927)
your_date <- as.POSIXct(your_julian*24*3600, origin="2022-07-08")
strftime(your_date, format="%H:%M:%S") 
#> [1] "11:18:45" "11:19:45" "11:20:45" "11:21:45" "11:22:45" "11:24:54"

Created on 2022-07-08 by the reprex package (v2.0.1)

Quinten
  • 35,235
  • 5
  • 20
  • 53