Share via


toUTCString 方法

更新:2007 年 11 月

傳回利用 Coordinated Universal Time (UTC) 轉換為字串的日期。

 function toUTCString() : String

備註

toUTCString 方法會以簡單易懂的格式傳回使用 UTC 規格設定格式的 String 物件。

範例

下列範例說明如何使用 toUTCString 方法。

function toUTCStrDemo(){
   var d, s;                   //Declare variables.
   d = new Date();             //Create Date object.
   s = "Current setting is ";
   s += d.toUTCString();       //Convert to UTC string.
   return(s);                  //Return UTC string.
}

需求

3 版

套用至︰

Date 物件

請參閱

參考

toGMTString 方法