1

I am new to react native ,I am trying to convert the given time "14:58" to utc in 24 hrs format. I am using the code like this

     let currentDate = new Date();
     startDate = new Date(currentDate.getTime());
     startDate.setHours(startTime.split(":")[0]);
     startDate.setMinutes(startTime.split(":")[1]);

     let startUTC = moment(startDate).utc();
     console.log(startUTC)

I am getting the result like this "2023-03-23T09:28:58.638Z" which in 12 hrs clock. Is there any way to convert this in 24 hr.

Manish Kumar
  • 997
  • 2
  • 13
  • 30
  • Does this answer your question? [Convert time to 24 hours format in Javascript](https://stackoverflow.com/questions/1788705/convert-time-to-24-hours-format-in-javascript) – Abe Mar 23 '23 at 17:28
  • No,given time "14:58" is converted to "2023-03-23T09:28:58.638Z", I wanted this time to be conveted in 24 hrs in utc – Manish Kumar Mar 24 '23 at 01:05

0 Answers0