Format number of minute to H:mm

Understanding basics of 1C:Enterprise platform. To start working with 1C:Enterprise platform visit Getting started page

#1
People who like this:0Yes/0No
Just came
Rating: 0
Joined: May 18, 2020
Company: 1C Innovation

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!

Edited: Đinh Quang Linh - Jun 05, 2020 12:52 PM
 
#2
People who like this:0Yes/0No
Just came
Rating: 0
Joined: Jun 9, 2020
Company:

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"]

 
Subscribe
Users browsing this topic (guests: 1, registered: 0, hidden: 0)
Be the first to know tips & tricks on business application development!

A confirmation e-mail has been sent to the e-mail address you provided .

Click the link in the e-mail to confirm and activate the subscription.