I have a string looking good in the following way:
TimeString = "2011.01.02 22:06:52.091"
Now I wanna convert it to double, and save it as a double number. I am doing it in c#, how could I do it?
Really can not find answer online.
Edit:
The time is kind of time stamp for financial currency quote:
Time bid ask
2011.01.02 22:06:52.091 1.5000 1.5001
it is the time stamp of Forex quote time. I prefer in this way: xxxxxxxxxxxxxxxx.ooo, the xxxxxxxxxxxxxxx is the int part to show how many seconds we have from "2011.01.02 22:06:52" and the .ooo is the milliseconds as "091" how do you think?
var span = DateTime.ParseExact(TimeString,
"yyyy.MM.dd HH:mm:ss.fff",
CultureInfo.InvariantCulture) -
new DateTime(2011, 01, 02, 22, 06, 52, 0);
double d = span.TotalMilliseconds/1000.0;
turns it into a double
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With