現在の時刻を文字列に
C++
time_t tim_v = ::time(NULL) ;
struct stm = ::localtime(&tim_v) ;
tstring buff ;
size_t size = 255 ;
buff.resize(size+1,0) ;
::_tcsftime(&buff[0],size,_T(“%Y/%m/%d %H:%M:%S”),&stm) ;
tstring str = buff.c_str() ;
MFC
CString str = CTime::GetCurrentTime().Format(_T(“%Y/%m/%d %H:%M:%S”)) ;
JavaScript
var time = new Date() ;
var y_ = time.getFullYear() ;
var m_ = time.getMonth() + 1 ;
var d_ = time.getDate() ;
var hh = time.getHours() ;
var mm = time.getMinutes() ;
var ss = time.getSeconds() ;
var str= (y_+”/”+m_+”/”+d_+” “+hh+”:”+mm+”:”+ss) ;
PHP
date_default_timezone_set(‘Asia/Tokyo’) ;
$str = date(“Y/m/d H:i:s”) ;