How to calculate Age from Birth Date

  • Автор темы Автор темы cherubin
  • Дата начала Дата начала

cherubin

Client
Регистрация
06.06.2016
Сообщения
92
Реакции
7
Баллы
8
Hi,

I would like to have in a value the age calculated from a date.
How can i do that?

I tried {-TimeNow.Date-}-{-Variable.BirthDate-} but it doesn't work.

Thanks
 
Hello,
You can use C# code in Action Own Code C# for this purpose
Код:
Развернуть Свернуть Копировать
System.Globalization.CultureInfo culture =System.Globalization.CultureInfo.CreateSpecificCulture("en-US");
DateTime date = DateTime.Parse(project.Variables["time"].Value, culture);
var date2 = DateTime.Now; //Current time
TimeSpan span = date2 - date;
double seconds = span.TotalSeconds;
http://zennolab.com/discussion/threads/sravnenie-dat.18740/#post-134407
 
  • Спасибо
Реакции: LightWood
thanks for your answer. I never used C# in Zenno, so how i may adapt your script? Where to put the variable BithDate ?
 
Amazing ! Thank you !
 

Кто просматривает тему: (Всего: 0, Пользователи: 0, Гости: 0)