Hello
I use V21 and need to put current date in (Date Type Field) by using edit tag (Client side event) .
I used (auto update value - currentDate()) but cannot calculate period between two dates.
I hope to get help please
Thanks
set current date
-
- User
- Posts: 77
set current date
-
- User
- Posts: 131
You want to calculate period between tow date, like, two different fields, right?
In this case you better do the math in c# (in Row_Insterting / Row_Updating).
The period is expressed in what? Days, Hours, Minutes?
-
- User
- Posts: 131
Code: Select all
DateTime dtStartDate = Convert.ToDateTime(rsnew["event_start_date"]);
DateTime dtEndDate = Convert.ToDateTime(rsnew["event_end_date"]);
TimeSpan tsDiffOfDates = dtEndDate.Subtract(dtStartDate);
int iDaysBetweenDates = diffOfDates.Days;
...
Go to learn.microsoft.com and look for TimeSpan
Struct for other examples ...
-
- User
- Posts: 946
If you want to calculate days between different dates in client codes, you can refer to the examples in:
https://aspnetmaker.dev/docs/#/customsc ... validate-9