Всем доброго дня.
У меня есть переменная в которой хранится начальное время в миллисекундах.
Есть таймер с текущим временем.
Как мне получить разницу этих значений в формате HH:mm:ss.SSS
Пытаюсь сделать вот так:
Но возникает ошибка: Argument to MakeInstant should have form MM/dd/YYYY hh:mm:ss, or MM/dd/YYYY or hh:mm
Мне важно получить результат с точностью до миллисекунд.
Подскажите, пожалуйста.
[mod edit] Community translator not coping with this, herewith translation:
Date and Time Format
Hello everyone.
I have a variable that stores the initial time in milliseconds.
I have a timer with the current time.
How can I get the difference between these values in the HH:mm:ss.SSS format?
I'm trying to do this:
But I get an error: Argument to MakeInstant must have the form MM/dd/YYYY hh:mm:ss, or MM/dd/YYYY or hh:mm
I need to get the result accurate to milliseconds.
Please help.
TIMAI2
June 11, 2026, 12:51pm
2
If you want your answer in milliseconds, then work in milliseconds to do your calculation. Only use the date/time format blocks for display purposes, these do no retain the values of the instants.
The systemtime block returns the current date/time in milliseconds.
Please also convert your blocks to English before posting.
or if you need to convert milliseconds to hh:mm:ss.SSS format check this extension:
Here is an extension to format the time / duration (millis) in different ways:
→ [ HH:mm:ss ] → [ days + HH:mm:ss ] → [ HH:mm ] → [ mm:ss ] → etc.
This is asked very often and always requires a lot of questions / answers and posts in the forum.
(Last here: Creating a Chronometer - #17 by PizzaGuy07 )
Hence this extension (some of it can also be implemented with the on-board methods, but I want to simplify it:):
Version 1 (May 20, 2020):
TFormat.aix (5.5 KB)
Version 2 (Oct 20, 2021):
TForm…
the block DurationToHourminSecMillisFrom should do the job ( only drawback is millis are preceded by a colon, but you can replace it )
Не совсем понятно, как мне получить с точностью до 1000?
Если у меня 2732 миллисекунд, то получаю 00:00:02
TIMAI2
June 11, 2026, 1:21pm
5
lara.ivanova.aa2020:
Не совсем понятно, как мне получить с точностью до 1000?
Если у меня 2732 миллисекунд, то получаю 00:00:02
(Because of British Summer Time anomaly:)
ABG
June 11, 2026, 1:32pm
6
Draggable:
alternatively:
P.S. These functions translate durations (measured in milliseconds) to durations (measured in hours, minutes, seconds.)
Do not confuse the milliseconds with the absolute time landmarks returned from Clock1.SystemTime, measured from 1970.
Where did the 7 hours come from?
tttt.aia (7.5 KB)
TIMAI2
June 11, 2026, 1:38pm
8
You may have to adjust for your timezone?
Thank you very much! Everything worked out.
It may be useful to someone else.
tttt.aia (7.8 KB)
Good you resolved, but you should have used the DurationToHourMinSecMillisFrom block ( and not DurationToHourminSecFrom )
1 Like
TIMAI2
June 11, 2026, 2:01pm
11
Is more fun figuring it out without extensions
1 Like
system
Closed
June 18, 2026, 2:01pm
12
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.