Reformatting in C #
2 answers
You can use TempusReader . This is an open source project where I started to tackle this exact problem (and teach myself how to use Parsley ).
Take a look at the examples on the GitHub page and see if it suits your needs. It will work for words like and
in your first example. For example:
TimeSpan x = new Time("2 days, 7 hours, 12 mins and 52 seconds") // 2.07:12:52
In addition, an object TempusReader.Time
can be implicitly transferred to TimeSpan
.
+7
source to share