Skip to main content
1-Visitor
February 12, 2020
Question

Question for UTC time

  • February 12, 2020
  • 1 reply
  • 1907 views

How to get UTC time in "DATETIME" format in service? . i want to store UTC time in result variable in services. result datatype is "DATETIME". i can get UTC time in string format. but not able to get UTC time in "DATETIME" format.please help me.

1 reply

Community Manager
February 12, 2020

Hi @DK2.

 

Which product?

DK21-VisitorAuthor
1-Visitor
February 13, 2020
Hi Slangley,
Thai is not for a product. I am trying to do this.
I am using this code :- var date = new Date();
var utcDate = date.toUTCString(); or var s = date.toISOString();
Both lines are giving me UTC time but in string format like "Wed Feb 12 2020 15:07:27 GMT-0000 (GMT)".
But when I convert this UTC string into datetime format using parseDate function like parseDate (utcDate, "yyyy-MM-dd HH:mm:ss"); or using new Date function like var dateString = new Date(utcDate)
It is giving me my system date in place of UTC time .
I have one variable "result" and data type is for that DATETIME .
Main Question :- I want UTC time in datetime format and want to assign in result variable.