0

Is it possible to display the date and the time in Ionic like if it's a real time clock (RTC)?
The only thing I found in the Ionic documents was a selector.

Does anyone have any suggestions?

zx485
  • 28,498
  • 28
  • 50
  • 59
Nouf
  • 733
  • 1
  • 11
  • 32

1 Answers1

0
let time = new Date().toLocaleTimeString();

You mean this ?

kalememre
  • 406
  • 3
  • 14
  • kind of I want the time to change this.datatime = new Date(); if a mint have pass the time will remain the same 12:30 will remain 12:30 even if it was 12:35 – Nouf Sep 30 '18 at 12:00
  • i dont understand what do you want but try another information; this.datatime = new Date(2018,10,1,22,50); it means 01/10/2018 22:50 if you will use this, your this.datatime never change according to time – kalememre Oct 01 '18 at 06:11
  • setInterval(() => { this.datatime = new Date(); console.log(this.datatime); }, 1000); , this is what I want – Nouf Oct 01 '18 at 10:01
  • [Check this link please](https://stackblitz.com/edit/ionic-qbp5r5) i hope it can be answered your all questions, this my way – kalememre Oct 01 '18 at 14:56