我需要在打字稿中定义一个时间,所以我已经将数据类型用作时间。但它给出了一个错误。有关数据类型的任何建议吗?
Here is the code which I'm getting the error.
export class Path {
public id:number;
public fromLoaction: string;
public toLocation: string;
public cost: number;
public time: time;
}
答案 0 :(得分:1)
Date
存储时间和日期:
public time: Date;
this.time = new Date();
console.log(this.time.getHours() + ':' + this.time.getMinutes());