I have an integer field in my database that contains a date value in the form yyyyMMdd
. Is it possible to parse this as a date in the form dd/MM/yyyy
as bound to a datagrid?
Currently the field is bound like this:
<asp:boundcolumn datafield="access_date" headertext="Last logged on"></asp:boundcolumn>
Why don't you use Date for dates in database ? You can convert int to datetime using following sample code:
var sdate = intdate.ToString();
var date = DateTime.ParseExact(sdate, "yyy/MM/dd", CultureInfo.InvariantCulture);