Hello. I am trying to convert an incoming datetime value that comes to our system in a string format. It seems that when the precision of milliseconds is above 7, the datetime parsing in .NET is not like a value and cannot convert / parse a value. I am a little fixated on what to do for this? My only thought is that there is a millisecond limit, and that more accuracy is impossible? But I want to confirm that this is so, and not to assume. Example:
string candidateDateTimeString = "2017-12-08T15:14:38.123456789Z"; if (!success) { success = DateTime.TryParseExact(trayportDateTimeString, "yyyy- MM-dd'T'HH:mm:ss.fffffffff'Z'", CultureInfo.InvariantCulture, dateTimeStyles, out dateTime); }
If I reduce the value of "f" to 7, then the date syntax will work fine. Is there a limit? Or am I doing something obvious wrong?
docs, 7 - .
DateTime ( 100 ), 12:00 , 1 0001 .
https://msdn.microsoft.com/en-us/library/system.datetime(v=vs.110).aspx
. : https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings
, . :
DateTime
DateTime 01.01.0001 00:00 64- . - 100 . , , . , , . , 100 , , Int64 .
Int64
DateTime.Now
DateTime.Now, , DateTime . , .
Stopwatch
Stopwatch, , , , DateTime.Now, 100 . .
, , (, ), DateTime . , .
Source: https://habr.com/ru/post/1690477/More articles:Почему setImmediate() выполняется до того, как fs.readFile() в Nodejs Event Loop работает? - javascriptHow can I create a handle to an expression or vector function and then build it? - functionReferenceError: FB not defined in Angular 5 Karma Unit Test - angularThe icons at the bottom of the navigation bar do not move according to the change in the size of the frame - htmlWhy doesn't the .bss segment grow when variables are added? - cconfig-map kubernetes multiple environments - spring-bootPython pdb debugger not found on macOS High Sierra - pythonHow can I briefly change the record field? - haskellAdd _redirects file to root path for Vue SPA hosted on Netlify - single-page-applicationFocus on entering and removing focus using jQuery - javascriptAll Articles