I am sure it should be simple, but I canβt figure out how to write it correctly on Google ...
I have a config that has a field:
TimeToPoll="1d"
Now I want to do something like :
TimeSpan.Parse(TimeToPoll);
Return time interval of one day.
In c #
EDIT: I'm looking for a method that allows you to parse "1d" as well as "1s" or "1y" etc. Is it possible?
Value:
"1d" parses to {1.00:00:00}
"1h" parses to {0.01:00:00}
"1m" parses to {0.00:01:00}
"1s" parses to {0.00:00:01}
source
share