•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP.NET section within the Web Development category of DaniWeb, a massive community of 391,908 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,624 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP.NET advertiser: Lunarpages ASP Web Hosting
Views: 9602 | Replies: 5
![]() |
You have a datetime. How you display it is up to you. The DateTime object supports multiple methods for displaying the date, as well as an overridden ToString that can take a format.
http://msdn2.microsoft.com/en-us/lib...e_methods.aspx
If for some reason you want it returned from the database as a string that is already formatted, the question is more relevant in an SQL forum, since it then becomes database dependent. SQL Server supports the convert function for dates, i.e.
convert(varchar,mydatefield,101)
http://msdn2.microsoft.com/en-us/lib...e_methods.aspx
If for some reason you want it returned from the database as a string that is already formatted, the question is more relevant in an SQL forum, since it then becomes database dependent. SQL Server supports the convert function for dates, i.e.
convert(varchar,mydatefield,101)
Last edited by nikkiH : Dec 29th, 2006 at 8:56 am.
Google is your friend. I'm giving examples, not typing up your whole app for you. You run code at your own risk.
Bored? Visit http://www.kaelisspace.com/
Bored? Visit http://www.kaelisspace.com/
Good points nikkiH!
One thing that can be done as well is to retrieve the date/time from the database as stored and use the parse/format methods in ASP.NET to produce the desired output.
Satees - the links nikkiH provide is an excellent starting point.
One thing that can be done as well is to retrieve the date/time from the database as stored and use the parse/format methods in ASP.NET to produce the desired output.
Satees - the links nikkiH provide is an excellent starting point.
Last edited by Paladine : Dec 30th, 2006 at 2:27 pm.
Assistant Manager, Regional Pharmacy Information Systems
TLC Services Website (Under Construction)
Updated : ASP.Net Login Code
TLC Services Website (Under Construction)
Updated : ASP.Net Login Code
•
•
Join Date: Jun 2006
Posts: 3
Reputation:
Rep Power: 0
Solved Threads: 0
If its in a gridview, something like this works
The whole grdiview might look something like this
<%# String.Format("{0:d}",Eval("dtmExpiration")) %> <asp:GridView Width="100%" BorderWidth="0" CellPadding="0" CellSpacing="0" BorderColor="white"
AutoGenerateColumns="FALSE" ShowHeader="false" ID="gvStores" runat="server">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<table>
<tr>
<td valign="top" width="110px">
<img border="0" src="images/<%# Eval("strLogo")%>" />
</td>
<td valign="top" class="bluebodytext">
<%# Eval("txtDescription")%>
<i>Offer Expires
<%# String.Format("{0:d}",Eval("dtmExpiration")) %>
</i>
</td>
</tr>
</table>
<div class="row">
</div>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView> Last edited by Paladine : Jan 4th, 2007 at 7:17 pm. Reason: Adding Code Blocks
•
•
Join Date: Nov 2007
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
you should check this out: http://developerstips.wordpress.com/...umn-in-aspnet/
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb ASP.NET Marketplace
- datetime format (MS SQL)
- Want Date Format in dd/mm/yyyy in ASP.Net With C#. (C#)
- datetime format in ms sql (MS SQL)
- need urgent help for a query (MS SQL)
- Log file rotation script (Perl)
Other Threads in the ASP.NET Forum
- Previous Thread: background-color:"9E0039" works in IE but not mozilla, solution?
- Next Thread: Content Changes across pages via Drop-Down Box



Linear Mode