Skip to main content

Display only Date in ASP.NET MVC view

Display only date into Razor View in ASP.NET MVC

Write this code in your View
@Convert.ToString(string.Format("{0:dd/MM/yyyy}", item.birthDay))

Comments

Popular posts from this blog

Generate invoice number through c#

In this article i will show you how to generate invoice number through c# in form of AJ0001/001, AJ0001/002 ... int invoiceNo = 1 ; while ( Console . ReadLine () != "stop" ) { for ( int i = 1 ; i <= 100 ; i ++) { Console . WriteLine ( "{0}/{1}" , invoiceNo . ToString ( "AJ0000" ), i . ToString ( "000" )); } invoiceNo ++; }

Handle no 'Access-Control-Allow-Origin' - issues on client side in ASP.NET WebAPI

Since your .NET Web API and Client-Side projects are being hosted on different ports, it's considered a Cross-Domain (CORS) request. Just add the proper header in your   web.config   from your web API application: <configuration> < system . webServer > <httpProtocol> <customHeaders> < add name = "Access-Control-Allow-Origin" value = "*" /> < add name = "Access-Control-Allow-Headers" value = "Content-Type" /> < add name = "Access-Control-Allow-Methods" value = "GET, POST, PUT, DELETE, OPTIONS" /> </ customHeaders > </ httpProtocol > </ system . webServer > </ configuration >