The following code obtains the number of seconds passed since the beginning of the minute the routine started and then outputs this number in different formats via the Format
method of the aqString
object.
JavaScript, JScript
function Main()
{
var a, b, i, s;
// The numbers that will be output
i = aqDateTime.GetSeconds(aqDateTime.Now());
// The number of seconds that have passed
// since the beginning of the current minute
a = i;
b = i / (60*60*24); // The number of seconds as part of a 24-hour day
// Decimal format
s = aqString.Format("%d ms have passed since the beginning of the current minute.", a);
Log.Message(s);
// Hexadecimal format
s = aqString.Format("%d = %X (hexadecimal format)", a, a);
Log.Message(s);
// General format
s = aqString.Format("%d ms = %g day (general format)", a, b)
Log.Message(s);
// Scientific format
s = aqString.Format("%d ms = %.4e day (scientific format)" , a, b);
Log.Message(s);
}
Python
def Main():
# The numbers that will be output
i = aqDateTime.GetSeconds(aqDateTime.Now())
# The number of seconds that have passed
# since the beginning of the current minute
a = i
b = i / (60*60*24) # The number of seconds as part of a 24-hour day
# Decimal format
s = aqString.Format("%d ms have passed since the beginning of the current minute.", a)
Log.Message(s)
# Hexadecimal format
s = aqString.Format("%d = %X (hexadecimal format)", a, a)
Log.Message(s)#
# General format
s = aqString.Format("%d ms = %g day (general format)", a, b)
Log.Message(s)
# Scientific format
s = aqString.Format("%d ms = %.4e day (scientific format)" , a, b)
Log.Message(s)
VBScript
Sub Main
Dim a, b, s, i
' The numbers that will be output
i = aqDateTime.GetSeconds(aqDateTime.Now())
' The number of seconds that have passed
' since the beginning of the current minute
a = i
b = i / (60*60*24) ' The number of seconds as part of a 24-hour day
' Decimal format
s = aqString.Format("%d ms have passed since the beginning of the current minute.", a)
Log.Message s
' Hexadecimal format
s = aqString.Format("%d = %X (hexadecimal format)", a, a)
Log.Message s
' General format
s = aqString.Format("%d ms = %g day (general format)", a, b)
Log.Message s
' Scientific format
s = aqString.Format("%d ms = %.4e day (scientific format)" , a, b)
Log.Message s
End Sub
DelphiScript
procedure Main;
var a, b, i, s;
begin
// The numbers that will be output
i := aqDateTime.GetSeconds(aqDateTime.Now());
// The number of seconds that have passed
// since the beginning of the current minute
a := i;
b := i /(60*60*24); // The number of seconds as part of a 24-hour day
// Decimal format
s := aqString.Format('%d ms have passed since the beginning of the current minute.', a);
Log.Message(s);
// Hexadecimal format
s := aqString.Format('%d = %X (hexadecimal format)', a, a);
Log.Message(s);
// General format
s := aqString.Format('%d ms = %g day (general format)', a, b);
Log.Message(s);
// Scientific format
s := aqString.Format('%d ms = %.4e day (scientific format)' , a, b);
Log.Message(s);
end;
C++Script, C#Script
function Main()
{
var a, b, i, s;
// The numbers that will be output
i = aqDateTime["GetSeconds"](aqDateTime["Now"]());
// The number of seconds that have passed
// since the beginning of the current minute
a = i;
b = i / (60*60*24); // The number of seconds as part of a 24-hour day
// Decimal format
s = aqString["Format"]("%d ms have passed since the beginning of the current minute.", a);
Log["Message"](s);
// Hexadecimal format
s = aqString["Format"]("%d = %X (hexadecimal format)", a, a);
Log["Message"](s);
// General format
s = aqString["Format"]("%d ms = %g day (general format)", a, b);
Log["Message"](s);
// Scientific format
s = aqString["Format"]("%d ms = %.4e day (scientific format)" , a, b);
Log["Message"](s);
}