Google Apps Script googleドライブ内のファイルの作成日時を取得する

環境
Windows 10 Home 64bit
Google Chrome  111.0.5563.149(Official Build) (64 ビット)
Google ドライブ

書式
getDateCreated(file)
ファイルの作成日時を取得するには、「getDateCreated」を使用します。

使用例

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function myFunction() {
// ファイル
let file = DriveApp.getFileById('xxxx');
console.log( file.getDateCreated() );
// フォーマットを指定
console.log( Utilities.formatDate(file.getDateCreated(), 'JST', 'yyyy-MM-dd HH:mm:ss') );
}
function myFunction() { // ファイル let file = DriveApp.getFileById('xxxx'); console.log( file.getDateCreated() ); // フォーマットを指定 console.log( Utilities.formatDate(file.getDateCreated(), 'JST', 'yyyy-MM-dd HH:mm:ss') ); }
function myFunction() {
 // ファイル
  let file = DriveApp.getFileById('xxxx');  

  console.log( file.getDateCreated() );

  // フォーマットを指定
  console.log( Utilities.formatDate(file.getDateCreated(), 'JST', 'yyyy-MM-dd HH:mm:ss') );

}

 

Google Apps Script

Posted by arkgame