Cool Solutions



January 29, 2008 12:23 pm






Download datetime

DateTime.nlm creates a new console command “DT” that prints the current date/time to the logger screen.

Module is DateTime.NLM, usage is:

Load DateTime

then from console or .ncf file

DT <format string>

where <format string> can include:

c - shortdateformat + ’ ’ + shorttimeformat
d - day of month
dd - day of month (leading zero)
ddd - day of week (abbreviation)
dddd - day of week (full)
ddddd - shortdateformat - eg 15-01-08
dddddd - longdateformat - eg 15 January 2008
m - month
mm - month (leading zero)
mmm - month (abbreviation)
mmmm - month (full)
y - year (four digits)
yy - year (two digits)
yyyy - year (with century)
h - hour
hh - hour (leading zero)
n - minute
nn - minute (leading zero)
s - second
ss -second (leading zero)
t - shorttimeformat
tt - longtimeformat
am/pm - use 12 hour clock and display am and pm accordingly
a/p -use 12 hour clock and display a and p accordingly
/ - insert date separator
: -insert time separator
'xx' or "xx" literal text 

Note that literal strings need to be in quotes eg: “some text” or ‘some text’
so eg:

cmd: DT
out:   2008-1-15 11:28

cmd: DT hh:nn:ss am/pm
out:   11:28:12 am

cmd: DT “Starting cron job:” ddd dd-mm-y hh:nn:ss am/pm
out:   Starting cron job: Tue 15-01-2008 11:28:12 am


0 votes, average: 0.00 out of 50 votes, average: 0.00 out of 50 votes, average: 0.00 out of 50 votes, average: 0.00 out of 50 votes, average: 0.00 out of 5 (0 votes, average: 0.00 out of 5)
You need to be a registered member to rate this post.

Categories: Uncategorized

Disclaimer: This content is not supported by Micro Focus. It was contributed by a community member and is published "as is." It seems to have worked for at least one person, and might work for you. But please be sure to test it thoroughly before using it in a production environment.