c# - DateTime conversion to FileTimeUtc -


i have datetime variable defined datetime.now. need "convert" filetimeutc. must misunderstanding because assumed work:

datetime runtime; runtime = system.datetime.now.tofiletimeutc(); 

but error cannot implicitly convert type long system.datetime.

any help? thanks.

datetime.tofiletimeutc returns long, not datetime. documentation:

a windows file time 64-bit value represents number of 100-nanosecond intervals have elapsed since 12:00 midnight, january 1, 1601 a.d. (c.e.) coordinated universal time (utc). windows uses file time record when application creates, accesses, or writes file.

this should be:

long runtime; runtime = system.datetime.now.tofiletimeutc(); 

if want current coordinated universal time, , not windows file time, can use:

datetime runtime = system.datetime.utcnow; 

see utcnow details.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -