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

Posted on 2013-06-11
Last Modified: 2013-06-21

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.

Question by:AidenA
  • 2
  • 2
LVL 18

Accepted Solution

Jerry Miller earned 500 total points
ID: 39238233
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.
LVL 69

Expert Comment

by:Scott Pletcher
ID: 39238679
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.

Author Comment

ID: 39241882
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!
LVL 18

Expert Comment

by:Jerry Miller
ID: 39242435
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.

Author Comment

ID: 39266178
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

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

778 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