Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

718
Views
how can I get hh:mm time from ISO without any time difference
createAlarm({
    active: true,
    date: picked_Date.toISOString(),
    message: 'sample alarm',
    snooze: 1,
});

I created an alarm using DatePicker(react-native-date-picker), and react-native-simple-alarm

...
<Text>{date}</Text>  // 2022-02-16T08:47:25.352Z

i just want HH : MM value in 24hours, like 13:42, 09:50 or 22:10. so i tried this code

<Text>{moment(date).format('hh:mm')}</Text> // 05:47

This did give me hh:mm formed value, but the value was not the same as my computer and ios simulator it was supposed to 08:47, cause the {date} was 2022-02-16T08:47:25.352Z

How can I get rid of the time difference? and set moment's time zone globally as same as the hardware(simulator or phone)?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

try moment.utc() . it will adjust your input time to UTC so you will the time you want.
also hh:mm will give 12 hour clock time so you will need HH:mm for 24 hour clock

//12 hr clock
var a = moment.utc('2022-02-16T08:47:25.352Z').format('hh:mm');
var b = moment.utc('2022-02-16T18:47:25.352Z').format('hh:mm');

console.log(a)
console.log(b)


//24 hr clock
var c = moment.utc('2022-02-16T08:47:25.352Z').format('HH:mm');
var d = moment.utc('2022-02-16T18:47:25.352Z').format('HH:mm');

console.log(c)
console.log(d)
<script src="http://cdnjs.cloudflare.com/ajax/libs/moment.js/2.2.1/moment.min.js"></script>

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!