Simple date time format


#1

hi guys,
facing some problem,
i am getting value as 2017-08-02T00:00:00 from API
i want to show date and time separately in browser
here is my code:
in .html:

Date
Status

{{item.AttendanceDate}}
{{item.Remarks}}

and this is my .ts file:
import { Component } from ‘@angular/core’;
import { IonicPage, NavController, NavParams } from ‘ionic-angular’;
import { UserProvider } from ‘…/…/providers/user/user’;
import { Storage } from ‘@ionic/storage’;
//import { Subject } from ‘rxjs/Subject’;

@IonicPage()
@Component({
selector: ‘page-subject-details’,
templateUrl: ‘subject-details.html’,
})
export class SubjectDetailsPage {

subject: any;
attendenceList: any;
user: any;
item: any
constructor(public navCtrl: NavController,
public navParams: NavParams,
public storage: Storage,
public userProvider: UserProvider, ) {

  this.storage.get('token').then((value) => {
    console.log('Token : ' + JSON.parse(value));
    console.log('Name : ' + JSON.parse(value).Name);
    this.user = JSON.parse(value);

  })

this.subject = navParams.get('item');

console.log('sub:'+this.subject);
this.subjectAttendence();

}

subjectAttendence() {
console.log(‘subject clicked’);
this.storage.get(‘token’).then((value) => {
console.log('subtoken: ’ + JSON.parse(value).AuthToken);
this.userProvider.subjectBasedAttnd(JSON.parse(value).AuthToken, this.subject.SubjectID).then(data => {
console.log('list: ’ + data)
this.attendenceList = data;
});
});
}

ionViewDidLoad() {

console.log('ionViewDidLoad SubjectDetailsPage');

}

}


#2

time to learn about pipes :wink:

do

ionic g pipe [name]