I have a dataframe with a date column and another time column:
AndIwanttoconcatenatethedatewiththetimetobeinthestringformat"2016-12-25T08:38:00"
Initially I was trying this way:
datainicial=vpnsessions2[1,3]
View(datainicial)
horainicial=vpnsessions2[1,4]
View(horainicial)
dataehora=paste(datainicial,horainicial,sep="T")
But the result I get is:
17160T31080
After searching I found that the time share is in seconds, and the date part is not sure, but I think it's in days.
I was able to sort out the time part by doing the following:
td <- seconds_to_period(horainicial)
dataehorain=paste(datainicial,sprintf('%02d:%02d:%02d', td@hour, minute(td), second(td)),sep="T")
View(dataehorain)
But the result is still not satisfactory:
17160T08:38:00
The time already appears fine but the date does not.
I have tried several ways to try to put the date right, but I can not.
View image with code and values: link