current time

current time - Messages

#1 Posted: 9/24/2013 2:43:57 PM
sublim21

sublim21

3 likes in 36 posts.

Group: User

Hey All,

I'd like to request a feature to get the current time.

timeRightNow:=curTime( 'format' )

where 'format' is the format of time requested (UTC, standard time, etc)

Thanks,

-Pete
#2 Posted: 9/24/2013 3:50:40 PM
Martin Kraska

Martin Kraska

1222 likes in 2150 posts.

Group: Moderator

A good start could be time().
You also can access the Maxima function timedate(), use string command format, as this is the only way to convey an empty argument list.

Function: timedate ()
Function: timedate (T)
timedate() with no argument returns a string representing the current time and date. The string has the format YYYY-MM-DD HH:MM:SS[+|-]ZZ:ZZ, where the fields are year, month, day, hours, minutes, seconds, and time zone offset in hours and minutes.

timedate(T) returns the time T as a string with the format YYYY-MM-DD HH:MM:SS[+|-]ZZ:ZZ. T is interpreted as the number of seconds since midnight, January 1, 1900, as returned by absolute_real_time.

Example:

timedate with no argument returns a string representing the current time and date.

(%i1) d : timedate ();
(%o1) 2010-06-08 04:08:09+01:00
(%i2) print ("timedate reports current time", d) $
timedate reports current time 2010-06-08 04:08:09+01:00
timedate with an argument returns a string representing the argument.

(%i1) timedate (0);
(%o1) 1900-01-01 01:00:00+01:00
(%i2) timedate (absolute_real_time () - 7*24*3600);
(%o2) 2010-06-01 04:19:51+01:00

timedate.PNG
Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
  • New Posts New Posts
  • No New Posts No New Posts