First, parse the string
to create an integer
or long
. Create a TimeSpan
from the result, then get the Days
property of that object:
var s = (long)Double.Parse(pAge);
var t = TimeSpan.FromSeconds(s);
Console.WriteLine(t.Days);
Note that the Days
property is an integer. It represents the number of whole days in the TimeSpan
. If you need to be more precise, include the number of hours as well, or seconds etc.
Also note that the example you gave (19521201000230.000000 seconds) represents about 619,000 years. My guess is that this is the default value returned by the query when a user has never changed their password. I'm bringing this up because it's longer than the max period of time that can be represented by a TimeSpan
(about 29,000 years) so this code won't work for the default value.