使い方
// PHP
$now = date('YmdHis');
// C#
var now = DateTime.Now.ToString("yyyyMMddHHmmss");
// python
now = datetime.datetime.now().strftime('%Y%m%d%H%M%S')
// Javascript 現在時刻取得(yyyymmddhhmmss)
function getCurrentTime() {
var now = new Date();
var res = "" + now.getFullYear() + padZero(now.getMonth() + 1) + padZero(now.getDate()) + padZero(now.getHours()) +
padZero(now.getMinutes()) + padZero(now.getSeconds());
return res;
}
// Javascript 先頭ゼロ付加
function padZero(num) {
return (num < 10 ? "0" : "") + num;
}
// CMD(WIndows)
set time_tmp=%time: =0%
set now=%date:/=%%time_tmp:~0,2%%time_tmp:~3,2%%time_tmp:~6,2%
echo %now%
// PostgreSQL
TO_CHAR(CURRENT_TIMESTAMP, 'YYYYMMDDHH24MISS')
// SQLServer
Format(GetDate(),'yyyyMMddHHmmss')
参考
https://qiita.com/hirossyi73/items/46e19ffcad758ab36b66