문제

Here is my problem:

I have a XElement storing a DateTime, and I want to get the Value property returning the DateTime in a custom format.
I was wondering if there is a way to include a IFormatProvider in the XElement.

도움이 되었습니까?

해결책

I think you are mixing things here. The XElement always stores its value as a string. To get a custom date format, you need to convert this string into a DateTime object first and then call ToString with the format you want to have.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top