Reputation: 3345
In my application, I am getting a finish timestamp data from server side which is in this format - 2021-02-19T06:30:58
. This is in UTC.
The requirement from client is to convert this timestamp in PST hours. The format should look like Feb 19, 2021 06:30 AM
(Time should be converted to PST hours) . How to do this in Angular/Typescript.
For now this is how I am doing in my html code - {{ (finishTimeStamp | date : 'MMM d, yyyy')}}
and it gives the result as Feb 19, 2021
.
How can I include the time as well after converting it to PST hours.
Upvotes: 3
Views: 1527
Reputation: 53
You can add time manually using getTime(). which gets time in milliseconds.
Eg:
curDate=new Date();
futDate=new Date(this.curDate.getTime()+330*60000);
This will add 5 hours 30 minutes to current time.
Upvotes: 2
Reputation: 9915
Maybe try this:
{{ (finishTimeStamp | date : 'MMM d, yyyy hh:mm a' : '-0800') }}
Upvotes: 4