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
Post a Comment