I have a date string "2017-01-19 10:34:36", it's coming from API.
I want to display it in HH:MM AM format in Ionic
Usage with Datetime Button If you need to present a datetime in an overlay such as a modal or a popover, we recommend using ion-datetime-button. ion-datetime-button should be used when space is constrained. This component displays buttons which show the current date and time values.
The international standard recommends writing the date as year, then month, then the day: YYYY-MM-DD.
To display datetime, you can just do it in angular2 way, using a pipe. Angular2 provides a DatePipe. You can use it like this:
{{info.createdDate | date: "yyyy/MM/dd HH:mm:ss"}}
[update]
If you want to display as format 'HH:MM AM', just use:
{{info.createdDate | date: "shortTime"}}
will be fine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With