//[result example]
//
// * 4 digit year number [%Y ] : 2004
// ・
// ・
// ・
// * date and time [%C ] : Fri Jan 23 16:56:15 JST 2004
// * date and time [%c ] : Fri Jan 23 16:56:15 2004
// * date (name base) [%#x] : %#x
// * date (number base) [%x ] : 01/23/04
// * time [%X ] : 16:56:15
// * AM/PM [%p ] : PM
// * time zone [%z ] : %z
// * same as %z [%Z ] : JST
// * persent sign [%% ] : %
//
exit getFormatTime()
function getFormatTime()
local b_time, f_time, msg, opt, i
local aFormat = { /* [0]: format, [1]: description */\
{ '%Y', '4 digit year number' } \
, { '%#Y', 'same as %Y' } \
, { '%y', 'last 2 digit year number (00-99)' } \
, { '%#y', 'last 2 digit year number ( 0-99)' } \
, { '%m', 'month number (01-12)' } \
, { '%#m', 'month number ( 1-12)' } \
, { '%B', 'complete month name' } \
, { '%b', '3 letter month name' } \
, { '%U', 'week of the year (Sunday is first (00-51)' } \
, { '%#U', 'week of the year (Sunday is first ( 0-51)' } \
, { '%W', 'week of the year (Monday is first (00-51)' } \
, { '%#W', 'week of the year (Monday is first ( 0-51)' } \
, { '%A', 'complete day of the week name' } \
, { '%a', '3 letter day of the week name' } \
, { '%w', 'day of the week number (0-6)' } \
, { '%#w', 'same as %w' } \
, { '%d', 'day number (01-31)' } \
, { '%#d', 'day number ( 1-31)' } \
, { '%H', 'hour (00-23)' } \
, { '%#H', 'hour ( 0-23)' } \
, { '%I', 'hour (01-12)' } \
, { '%#I', 'hour ( 1-12)' } \
, { '%M', 'minute (00-59)' } \
, { '%#M', 'minute ( 0-59)' } \
, { '%S', 'second (00-59)' } \
, { '%#S', 'second ( 0-59)' } \
, { '%j', 'day of the year (001-366)' } \
, { '%#j', 'day of the year ( 1-366)' } \
, { '%C', 'date and time' } \
, { '%c', 'date and time' } \
, { '%#x', 'date (name base)' } \
, { '%x', 'date (number base)' } \
, { '%X', 'time' } \
, { '%p', 'AM/PM' } \
, { '%z', 'time zone' } \
, { '%Z', 'same as %z' } \
, { '%%', 'persent sign' } \
}
b_time = curtime()
loop i=0; i<count(aFormat); i++
msg = rpad(aFormat[i][1], 40)
opt = rpad(aFormat[i][0], 3)
f_time = formattime(b_time, aFormat[i][0])
print('* ' & msg & ' [' & opt & '] : ' & f_time, stdout)
endloop
endfunction