These lines give the date and time in UTC:
t:timedate(absolute_real_time() - (10*3600));
t0:substring(t,1,20);
t1:concat(substring(t,12,17), " ", substring(t,9,11), "/", substring(t,6,8), "/", substring(t,1,5));
t2:concat(substring(t,1,5), substring(t,6,8), substring(t,9,11), substring(t,12,14), substring(t,15,17), substring(t,18,20));
I know that '?\*autoconf\-version\*;' can give the Maxima version number, so maybe there is some undocumented way to get the local time.
Otherwise are there any ready-made functions that can convert UTC time to local time given conditions for start/end of daylight saving time e.g. UTC time to UK time (which is GMT/BST depending on the time of year)?
To clarify the problem, before revealing the solution: these are the steps that I take in Maxima v5.30 to get the time in UTC, in a readable format:
Note: When I use Maxima v5.30 (in the UK), for some unknown reason, the time is always UTC adjusted by 10 hours, and does not adjust for DST.
Note: timedate works better/differently in later versions of Maxima, but some institutions recommend installing a specific version of Maxima.
Sometimes I want the date in the form: 'yyyyMMddHHmmss'. A function for this is:
Note:
[d1,d2]
keeps those variables local to within the block, and not global.To get the local time I have to add on hours based on my time zone (0 in the UK), and DST. To calculate whether a time is within the DST period requires an individual function per time zone: in the UK, and many European countries, one such function is:
You can create a mac file with such a function, and call up the the function when needed, e.g.: