Answered by:
field template for sql date datatype

Question
-
User-15190661 posted
can someone tell me how i can create and implement a field template for a sql date field which doesnt include the time as part of it?
Friday, June 22, 2012 11:41 AM
Answers
-
User-1336852631 posted
can someone tell me how i can create and implement a field template for a sql date field which doesnt include the time as part of it?
You can use the standard DateTime and format it using the Display attribute, e.g:
[DisplayFormat(DataFormatString = "{0:d}" )]
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Friday, June 22, 2012 2:09 PM -
User3866881 posted
[DisplayFormat(DataFormatString = "{0:d}" )]
Agree!My addition——
[DisplayFormat(DataFormatString = "{0:yyyy/MM/dd HH:mm:ss}" )]
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Saturday, June 23, 2012 10:24 PM
All replies
-
User-287491473 posted
I'm not sure if you can. You could use the standard datetime type and leave the time set to 00:00:00. Many pieces of software will automatically format that to just show the date without the time (Excel does this, for example). I think that is a pretty accepted standard.
Friday, June 22, 2012 1:17 PM -
User-1336852631 posted
can someone tell me how i can create and implement a field template for a sql date field which doesnt include the time as part of it?
You can use the standard DateTime and format it using the Display attribute, e.g:
[DisplayFormat(DataFormatString = "{0:d}" )]
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Friday, June 22, 2012 2:09 PM -
User3866881 posted
[DisplayFormat(DataFormatString = "{0:d}" )]
Agree!My addition——
[DisplayFormat(DataFormatString = "{0:yyyy/MM/dd HH:mm:ss}" )]
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Saturday, June 23, 2012 10:24 PM