I came across the following syntax to format an Eval expression so it displays a short date formatted according to the user's locale:
<%#((DateTime)Eval("ExpDate")).ToString("d")%>
The key is casting Eval as a DateTime which you can then convert to String. At this point you can take advantage of the ToString format "d" which uses a locale short date format.
This works for ASP.Net 2.0 and later, it will save you having to create a function to determine the users locale.
Will
Works Great!
ReplyDeleteThanks!