kwilliams Posted March 12, 2008 Share Posted March 12, 2008 I'm using the following code to pull the current date in mm/dd/yyyy format:Dim dtCurrDate As DateTime = DateTime.Now 'Assign current dateOn the test server, 03/12/2008 11:25:50 AM is returned, and the date is formatted properly (mm/dd/yyyy). But on the web server, 3/12/2008 11:25:50 AM is returned and the date is not formatted properly (m/dd/yyyy). My Network Administrator made sure to change the date format on the server from m/dd/yyyy to mm/dd/yyyy, but it didn't fix the problem when I re-loaded the page. Both servers are running ASP.NET 2.0. What could be causing this problem? Link to comment Share on other sites More sharing options...
jesh Posted March 13, 2008 Share Posted March 13, 2008 When you want to convert your DateTime object into a string, you can pass a format string to tell .NET how to build the date string.In C# DateTime dtCurrDate = DateTime.Now;Response.Write(dtCurrDate.ToString("MM/dd/yyyy HH:mm:ss tt")); Check out this great page for different date format string options:http://authors.aspalliance.com/aspxtreme/a...s.aspx?pageno=3 Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.