Pages

Showing posts with label null. Show all posts
Showing posts with label null. Show all posts

Sunday, May 25, 2014

How to give custom Date format for null type

Say you have model like below.

Model

public DateTime? date { get; set; }

Then you can use ur View as below.

View

<%: date.HasValue ? date.Value.ToString("yyyy-MM-dd hh:mm:ss") : "[N/A]"%>
Read More..