Reputation: 260
I have this function with MomentJs
CreateFormat(date: string, time: string): string {
let now = moment(date + " " + time, "YYYY-MM-DD H:m:s z").toDate();
return moment(now, "YYYY-MM-DD H:m:s z").format("HH:mm");
}
I got this result : 7:39 pm i want to display it like this 19:39
Upvotes: 1
Views: 708
Reputation: 89
in ts file start_timestamp = 1500536460;
print like this in html <p class="timeLabel">{{start_timestamp | date:'YYYY-MM-DD H:m:s z'}}</p>
Upvotes: 0
Reputation: 65988
I highly recommend using momentJs with your Ionic 3
app.Then you won't have any browser specific errors like you have now.
npm install moment
.ts
import moment from 'moment';
let now = moment().format('LLLL');
Update:
moment("02:00 PM", "h:mm A").format("HH:mm") // "14:00"
Upvotes: 1
Reputation: 89
You can do like this ` {{start_timestamp | date:'HH:mm a'}}
Upvotes: 0