簡體   English   中英

打字稿中用來表示時間的數據類型是什么?

[英]What is the data type that is used in typescript to denote a time?

我需要在打字稿中定義一個時間,因此我已將數據類型用作時間。 但它給出了一個錯誤。 關於數據類型有什么建議嗎?

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;

    }

Date存儲時間和日期:

public time: Date;

this.time = new Date();
console.log(this.time.getHours() + ':' + this.time.getMinutes());

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM