Desktop version

Main > Forum > 1C:Enterprise Platform > Studying 1C:Enterprise platform > Format number of minute to H:mm

Forum

Search UsersRules
Format number of minute to H:mm
#1
Just came
Points:: 0
Joined:: May 18, 2020

I am having trouble with calculating the total time (hour and minute in format H:mm).
Firstly I tried to make its type in Document is Date, but Date type can not sum the total time.
Now I am trying to make its type in Document becomes number, I can calculate the sum but I can not display it in Document with format H:mm (ex: 100 -> 1:40).
I hope that someone can help me with this issue.
Thank you a lot!

Profile
#2
Just came
Points:: 0
Joined:: Jun 9, 2020

Hello, Đinh Quang Linh,

You can use type "Date" with Date contents "Time", it views in forms like HH:mm:ss (you can change view by presentation format). So when you need add minutes you can do it like:
[time = 01:00:00]

Code
time = time + 60 * 60;

[time = 02:00:00]
But be careful if you write 60 * 60 + time you will get error.
Also you can work with Number, some configurations stores time in number and convert it in views with format function. For example,
Code
a = 100;
H = Int(100/60);
mm = a - H*60;
time = Format(H, "ND=2; NZ=; NLZ=; NG=") + ":" + Format(mm, "ND=2; NZ=; NLZ=; NG=");

[time = "01:40"]

Profile
Subscribe
Users browsing this topic (guests: 1, registered: 0, hidden: 0)



© 1C LLC. All rights reserved
1C Company respects the privacy of our customers and visitors
to our Web-site.