Из числовой строки получить время

inotoxic

Client
Joined
Apr 20, 2015
Messages
354
Reaction score
164
Points
43
В переменной
int time = "1547659605"; //число получено в ходе вычислений и может означать минут или часы

?Как из переменной получить строку времени, вида HH:mm:ss
 
Last edited:

SanchoPancho

Client
Joined
Dec 9, 2015
Messages
176
Reaction score
88
Points
28
Code:
int time = Convert.ToInt32(project.Variables["time"].Value);
DateTime pDate = (new DateTime(1970, 1, 1, 0, 0, 0, 0)).AddSeconds(time);
return pDate;
 
  • Thank you
Reactions: inotoxic

inotoxic

Client
Joined
Apr 20, 2015
Messages
354
Reaction score
164
Points
43
Пардон ошибся с данными в строке
правильно
int time = "77738";//время не в формате unixtime

При выполнении снипета
Code:
int time = Convert.ToInt32(project.Variables["time"].Value);
DateTime pDate = (new DateTime(1970, 1, 1, 0, 0, 0, 0)).AddSeconds(time);
return pDate;
В переменную возвращается дата в формате
01.01.1970 21:35:38

А нужно что-бы вернуло кол-во часов и минут
 
Last edited:

Users Who Are Viewing This Thread (Total: 1, Members: 0, Guests: 1)