Solved

one date appearing in american format in production - cannot replicate in devolpment

Posted on 2013-06-11
5
225 Views
Last Modified: 2013-06-21
Hi,

This could be very specific to our code, but I have a date which is being updated in a textbox as, say, 09/06/2000 but then returned as 06/09/2000. Other dates are being sent and returned correctly, so there is something different about this particular situation. The code is kind of complex and I can't post any anyway (it is classic asp by the way) and the server is SQL Server, and it does use the function like CONVERT(varchar(10), myDate, 103) to return both the dates that are working fine and the one that isn't (in different procedures).

Since there is so much code, tables, stored procedures etc it is hard to track exactly what is going where but currently I can't see why this would happen. So, just in case someone has any ideas I thought I would try and ask this question!

The globalization has been set on the server and on the websites web.config as english so at this stage it doesn't look so much like a globalization issue and since some dates work fine that would back that up. So, must be something somewhere specific to that textbox and data.

Aiden
0
Comment
Question by:AidenA
  • 2
  • 2
5 Comments
 
LVL 18

Accepted Solution

by:
Jerry Miller earned 500 total points
Comment Utility
Probably the only way to find it is to "track exactly what is going where" to see the data flow.

First, execute the stored procedures or queries using the variable values and verify the results.

Next, make sure that the  format is not being changed on the display page only, by simply verifying it against a working one.

Next you will have to put in breakpoints and follow the date value until it changes.

I understand you not being able to post code, I can't post work code either.
0
 
LVL 69

Expert Comment

by:ScottPletcher
Comment Utility
Each PC will also have its own local date settings.

Maybe the local date setting on that PC is different from what is "normal" for your environment.
0
 

Author Comment

by:AidenA
Comment Utility
Hey, I've gone through all the code and can't see any issue. As I was saying, I can't replicate in development... and also there is no possibility to debug anything. This is a very old classic asp application and we can't debug it, we can only use response.write to the screen to see what is happening as the website is running. Pretty ridiculous but there you go. No one has gotten around to trying to get this working in debug mode.

So, we can't step through production either. I think I've ruled out the database as the issue as the data entering and leaving the stored procedures seem ok. in fact, what we have here is that when the user clicks the submit button on the form, the date is sent to the database and is saved in the reverse order (mm and dd switched).

Is it possible to view the date (say using IE developer tools (I think IE can only be used for this site)) before it is sent to the server to see what it looks like then. Actually, I think maybe I can do that with fiddler right... might try and check that tomorrow... if you've any other ideas throw them at me!
0
 
LVL 18

Expert Comment

by:Jerry Miller
Comment Utility
If you suspect that it is being changed on the submit button, you can look at the database field where it is being saved to verify. Then take a look at the button code to see what format it is sending. Also look at that query / stored procedure to make sure it formatting correctly. That is a much better approach than looking through all of them. There has to be some difference between your development and production environments.

Fiddler would let you see the values, so you can see where in the process it is occurring. I would never suggest stepping through production code, that is why development is used. If it works fine in dev there could be a setting on the web server, but it is only on one textbox and not all of them so I doubt that is the issue.
0
 

Author Comment

by:AidenA
Comment Utility
ok I think I solved this one and nobody would have gotten it really, or at least it wasn't obvious. Seems that ADO.NET was doing some kind of implicit conversion. The date was being passed in as a string but then, because the query was using parameters it was being implicitly converted to some kind of date parameter.

Because it's ADO.NET i can only assume that maybe some kind of IIS setting looks after this or it is somehow dependent on the user logged in... don't know really but seems to be sorted.

thanks for suggestions anyhow
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now