How to get only specific value of time in R

r

#1

I want to know only the sec of current time I have used Sys.time () but I am getting a large character
x<-Sys.time()
x
[1] "2015-08-13 20:07:50 IST"
here i am getting second in a character but i want it individually


#2

We can use as.POSIXct to get the specific value of time

x = Sys.time()

x
[1] β€œ2015-08-13 21:01:58 IST”

format(as.POSIXct(x),format="%S") # to get the second from time
[1] β€œ58”

Hope this helps!