How to elegantly convert datetime from decimal to “%d.%m.%y %H:%M:%S”?

后端 未结 2 1890
你的背包
你的背包 2021-01-18 03:28

I am doing an experiment which produces automatically logged data. The software produces a timestamp that is of the format 41149.014850. I would like to convert

2条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-18 04:19

    This gets close: The numbers indicate the number of seconds since a date close to 1/1/1900:

    as.POSIXct(x*3600*24, origin=as.Date("1900-01-01")-2, tz="UTC")
    [1] "2012-08-28 01:06:40 BST" "2012-08-28 01:14:01 BST" "2012-08-28 01:21:23 BST"
    [4] "2012-08-28 01:28:44 BST"
    

    There still is a timezone offset in there.

提交回复
热议问题