I have date value from postgres
db without timezone. I want this display in angular 2 template with timezone and locale
postgres db value : 2017-11-14 09:40:59.753
I just displayed date in angular template using {{codeset.created_on}}
it will be displayed below like :
Tue Nov 14 2017 09:40:59 GMT+0530 (IST)
But I want display current time based on timezone with locale
I tried like below in angular template :
<span>{{codeset.created_on | date :'dd/MM/yyyy h:mm a' :'+530' :'en-US'}}</span>
You can set it globally by providing LOCALE_ID
to your app. In your app.module.ts
for example:
import { LOCALE_ID } from '@angular/core';
@NgModule({
declarations: [ ... ],
imports: [ ... ],
providers: [
...
{ provide: LOCALE_ID, useValue: 'nl-NL' }
],
bootstrap: [ AppComponent ],
})