Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

712
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda