473,320 Members | 2,112 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

US vs UK datetime/string format failing on certain machines. Ideas

I'm having a problem with dates.
(No not the sort that you have at christmas)

I have a webform with a text box and a calendar control.
You can either
- enter a date manually (we are talking uk style here dd/mm/yyyy) in the
textbox
- click a date on the calendar which puts the date value in the textbox (uk
style)

pointing a browser at my machine this works fine
pointing at the UAT and production machines it falls in a heap with the
error shown below

I've asked our admin to check and he says everything is configured to be uk
where possible

This is for an intranet app so i'm not bothered about time zones and all
that crap.
i've seen a bunch of postings where people are using
datetime.parse(xx,formatprovider) with all sorts of bits and pieces
and some of the formatting things are crazy
5 or 6 lines of code just to format something from a text box

i thought asp.net was supposed to make you more productive with fewer lines
of code!

why am i getting the error?
is there any file on the servers in question i can change to make it work?

also

all of the other date values on the screen (when using the other servers)
are shown using US date format

can anyone shed any light on this?

thanks!

ERROR START-----

Server Error in '/inDus' Application.
--------------------------------------------------------------------------------

String was not recognized as a valid DateTime.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information about
the error and where it originated in the code.

Exception Details: System.FormatException: String was not recognized as a
valid DateTime.

Source Error:

An unhandled exception was generated during the execution of the current web
request. Information regarding the origin and location of the exception can
be identified using the exception stack trace below.

Stack Trace:

[FormatException: String was not recognized as a valid DateTime.]
inDus.Data.Release.CreateNewRelease(String Description, String
ReleaseDate, Int32 ProjectID)
inDus.Releases.AddRelease.CmdCreateRelease_Click(O bject sender, EventArgs
e)
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108

System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler
sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1292


--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.2032; ASP.NET
Version:1.1.4322.2032
ERROR END-----
Nov 18 '05 #1
1 2458
I have a webform with a text box - enter a date manually (we are talking uk style here dd/mm/yyyy) in the Does this work on all machines?
- click a date on the calendar ... (uk style) Is the problem that putting the date converts it to mm/dd/yyyy ?
I've asked our admin to check and he says everything is configured to be
uk
where possible Hey it*s your Job ;-)
i've seen a bunch of postings where people are using
datetime.parse(xx,formatprovider) with all sorts of bits and pieces If you know what your users enter (Intranet) you shouldn't need that.
i thought asp.net was supposed to make you more productive with fewer
lines
of code!
why am i getting the error?
is there any file on the servers in question i can change to make it work?

also

all of the other date values on the screen (when using the other servers)
are shown using US date format

can anyone shed any light on this?


What is you Culture and UICulture in the web.config - if it's not set it'll
be en-US

<configuration>
<system.web>
<globalization
culture="en-US"
uiCulture="en-US"
....

you can set the culture by code to

System.Threading.Thread.CurrentThread.CurrentCultu re =
System.Globalization.CultureInfo.CreateSpecificCul ture("en-US");
System.Threading.Thread.CurrentThread.CurrentUICul ture =
System.Threading.Thread.CurrentThread.CurrentCultu re;
--
Daniel Fisher(lennybacon)
MCP ASP.NET C#
Blog: http://www.lennybacon.com/

Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: antao | last post by:
I'm keeping in the database a log of all the sessions for my application. I'm trying to write a stored procedure that returns all the sessions that; the login contains a certain string, loggedin...
1
by: Ugur Ekinci | last post by:
Hi , I have two Sql Server 2000 on seperate machines , First one accepts datetime format like ("dd.MM.yyyy hh:mm:ss") And Second one accepts datetime format like ("MM.dd.yyyy hh:mm:ss") 1-...
4
by: Sugandh Jain | last post by:
Hi, I am using dotnet framework 2.0, visual studio 2005. We are using DateTime.Now.ToUniversalTime().GetDateTimeFormats() to format the string in particular format and using...
3
by: Sugandh Jain | last post by:
What you have told is a nice way. but this is taking hour in 12 hour format, but I want it in 24 hour format, because I have to it to generate ID's which always increase in value. How to use it in...
4
by: =?Utf-8?B?c2lwcHl1Y29ubg==?= | last post by:
Hi I am having a problem formatting a string when the time is in format hh.mm.ss - used in Europe Parse seems ok when the date uses "/" or "." as seperator but I get an exception when time...
1
by: =?Utf-8?B?Q01hcnRpbg==?= | last post by:
How do I get the value of DateTime to show two characters when it is inthe AM? What I get in PM = 10/31/07 12:34:22 PM What I get in AM = 10/31/07 2:34:22 AM I need: 10/31/07 02:34:22 AM To...
3
by: David | last post by:
Hi all, I am using .NET 2 I have to work with short dates, e.g. 23 April 2008 will come to me as 23/04/08 I am splitting this value into int to put into a DateTime type... DateTime...
5
by: John B | last post by:
Hi all, Any idea why this code results in a FormatException? DateTime.ParseExact("40708", "dMMyy", CultureInfo.CurrentCulture) If I use "040708" with the same format string it works and it...
5
by: Sreenivas | last post by:
Hi every one, I need to compare to datetime values , done in stored procedure.The input datetime parameter is in dd/mm/yyyy hh:mm:ss AM/PM format ,the datetime values to be compared are also...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.