[R] How to convert column from millisecond epoch time to yyyy-mm-dd GMT

Gregg g@@@powe|| @end|ng |rom protonm@||@com
Tue Jun 23 07:13:32 CEST 2020


Hello to all the smart people out there....

I have a data.frame labeled itsm_service_type_field. I need to convert the Timestamp field which is epoch time in milliseconds to a yyyy-mm-dd GMT Date. 

Data.frame format is below.

I've attempted to use the lapply and as.POSIXct functions to convert the time field in the original data.frame to a new data.frame I've labeled "itsm_service_type_field_adjusted_time",
but I've got the order and syntax wrong.

Help would be so much appreciated.

Thanks in advance.
Gregg
Arizona

Details - See Below:

itsm_service_type_field <- fread("itsm_service_type_2018-2019_CONUS.csv")

>>>>>>>>>>>>>???????????itsm_service_type_field_adjusted_time <- lapply(itsm_service_type_field[ , Timestamp], as.POSIXct(Timestamp, origin="1970-01-01", tz="GMT"))

head(itsm_service_type_field)
    Id                              Timestamp         Data Type Visibility                      TYPE_SERVICE
1: INCBR0005072277 1577059200000 itsm-ticket U&FOUO&USA            0
2: INCBR0005073034 1577059200000 itsm-ticket U&FOUO&USA            1
3: INCBR0005073131 1577059200000 itsm-ticket U&FOUO&USA            0
4: INCBR0005074186 1577059200000 itsm-ticket U&FOUO&USA            0
5: INCBR0005074188 1577059200000 itsm-ticket U&FOUO&USA            0
6: INCBR0005074546 1577059200000 itsm-ticket U&FOUO&USA            0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 477 bytes
Desc: OpenPGP digital signature
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20200623/b4584a9c/attachment.sig>


More information about the R-help mailing list