4

I am trying to find the timestamp in R so I used the anytime function as follows:

Timestamp = anytime::anytime(paste(Date, Time)) 

but then I realise that the timestamp has BST and GMT. How can I get my timestamp without GMT or BST?

Thank you!

N.A.K
  • 35
  • 6

1 Answers1

1

The function anytime returns a POSIX time object that you can display in any desired format. To omit the timezone, you would simply leave it out in the format specification:

x = anytime::anytime(paste(Date, Time))
Timestamp = format( x, "%Y-%m-%d %H:%M:%S" )

See ?format.POSIXct for more information.

Artem Sokolov
  • 13,196
  • 4
  • 43
  • 74
  • While you may have solved this user's problem, code-only answers are not very helpful to users who come to this question in the future. Please edit your answer to explain why your code solves the original problem. – Joe C Jan 31 '17 at 21:02
  • Thanks, Joe. I improved the answer and added some description of what's going on. – Artem Sokolov Jan 31 '17 at 21:18