formatting Datetime string
i have the following object that can be nullable at times follows public string issued {get;set;} The issued string looks like this: 2022/02/29 22:00:00 +00:00 I want to assign the issued variable to another variable as 2022/02/29 when its not null. This is what i tried: var item = new model() { issuedDate=issued.IsNullOrEmpty() ? "" : issued.ToString("yyyy/mm/dd") } But it throws an error: can not convert from string to system.IformatProvider? How can I fix this?
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.