c# - DateTime cannot resolve ToShortTimeString() -


i have windows phone app have been using toshorttimestring method on datetime attributes.

i using code in windows 8 store app , getting errors toshorttimestring cannot resolved. when check available on datetime object see smaller list of options available - date few missing options (one of 'toshorttimestring'.

have done dumb here?

am missing namespace? using 'system' although resharper telling me not required.

toshorttimestring isn't supported in windows 8 store apps. can see when check "version information" in the documentation. doesn't mention windows 8 store apps.

but that's not problem. can create method yourself:

public static class datetimeextensions {     public static string toshorttimestring(this datetime datetime)     {         return datetime.tostring("t", datetimeformatinfo.currentinfo);     } } 

Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -