0

My firebase database has this type of time enter image description here

Then I want to show that time in front view like this ( 6.00 AM.. etc).I retrieve Rides details already. When I search about this I got some idea about Firebase.ServerValue.TIMESTAMP but I have no idea how to apply it with my code.

Component.ts

getRides(){
   this.ridesService.getRidesByRideID(rideId).subscribe(response => {
      this.activeridesList.push({
        rideDetails : response,
      });
    });
};

Edit

I already take value from database like , ' departure-timestamp: 1535520712696 ' .I want to convert that time like ' 6.00 AM ' .So I use Moment.js. In my front end I use ' {{ (activeRide.rideDetails.departure-timestamp | amFromUnix) | amDateFormat:'hh:mmA'}} ' but it's not work.

georgeawg
  • 48,608
  • 13
  • 72
  • 95
Rika
  • 333
  • 2
  • 5
  • 19
  • check this https://stackoverflow.com/questions/34718668/firebase-timestamp-to-date-and-time/34719492 – Jen Jose Sep 10 '18 at 05:48
  • I already take value like this, ' departure-timestamp: 1535520712696 ' .I want to convert that time like ' 6.00 AM ' .So I use Moment.js. In my front end I use ' {{ (activeRide.rideDetails.departure-timestamp | amFromUnix) | amDateFormat:'hh:mmA'}} ' but it's not work. – Rika Sep 10 '18 at 11:14
  • what is the output? – omurbek Sep 10 '18 at 11:39
  • I refer this [link](https://stackoverflow.com/questions/21848407/convert-time-stamp-to-date-inside-angular-expression-like-new-datetimestamp) . change my Front End code => `{{activeRide.rideDetails.departure-timestamp | date:" h:mma"}}` but nothing show .But when I use put time in manually like this `{{'1535520712696' | date:" h:mma"}}` then it's work. – Rika Sep 10 '18 at 11:54

0 Answers0