Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DateTime ASP.NET Vs Classic ASP 3

Status
Not open for further replies.

MarkZK

Technical User
Jul 13, 2006
202
GB
Hi all,

In classic asp and asp.net using the following code ...


Code:
<%=Now()%>
returns two different outputs,
in classic asp
7/14/2009 6:01:20 PM

and in asp.net
14/07/2009 18:01:24

because of the different placement of the day/mouth (and maybe because of the 24 hours time ?) the asp.net version is playing havoc with my SQL database.

the question is, is there an easy way to make asp.net return the old classic asp version of the "Now()" function ?

Thanks.

 
this is most likely an issue with cultural timezone settings. for presentation you can use the ToString("...") override and provide the format you want displayed.

Jason Meckley
Programmer
Specialty Bakers, Inc.

faq855-7190
 
try this

Code:
  Dim test As String = Date.Now
  Response.Write(test)
 
only in vb could a date object be a string struct :)

Jason Meckley
Programmer
Specialty Bakers, Inc.

faq855-7190
 
Hi Taree, That code returns the same as "=Now()", Thanks

Hi J Meckley, Thanks for the settings advice, after a little google on that I found ...

Code:
<%@ Page UICulture="en" Culture="en-us" %>

adding that gives me the same as classic asp, must be a UK thing :)

Thanks all.
 
mark, you taught me something as well.

Jason Meckley
Programmer
Specialty Bakers, Inc.

faq855-7190
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top