getDateTime() only returns two year digits, meaning it will not work if you happen to be a time traveller from 1920 or 2120.
If you need the full year, this is the function you need.
// returns the date and time, with the full current year
function getFullDateTime()
{
// get the current date and time from getDateTime
%value = getDateTime();
%date = getWord(%value, 0);
// if the date has changed, or the date has never been set, get the current century by creating a temporary file
if ($CurrDate $= "" || $CurrDate !$= %date)
{
$CurrDate = %date;
%file = new FileObject();
%file.openForWrite("base/temp/temp.txt");
%file.close();
%file.delete();
$CurrCentury = getSubStr(getFileModifiedSortTime("base/temp/temp.txt"), 0, 2) + 19;
fileDelete("base/temp/temp.txt");
}
// replace the year in the date with the full year
%date = strReplace(%date, "/", " ");
%date = setWord(%date, 2, $CurrCentury * 100 + getWord(%date, 2));
// return the full date and time
return strReplace(%date, " ", "/") SPC getWord(%value,1);
}
Known issues:
Does not work if the current year is before 1900. If you're time travelling from 1899 or before, you're out of luck.
Does not work if the function is called on the same day of the year, 100 years apart.
Does not work if the file base/temp/temp.txt exists, is read-only, and has a last modified date in a different century.