473,651 Members | 3,049 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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,formatprovid er) 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.FormatEx ception: 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.Rele ase.CreateNewRe lease(String Description, String
ReleaseDate, Int32 ProjectID)
inDus.Releases. AddRelease.CmdC reateRelease_Cl ick(Object sender, EventArgs
e)
System.Web.UI.W ebControls.Butt on.OnClick(Even tArgs e) +108

System.Web.UI.W ebControls.Butt on.System.Web.U I.IPostBackEven tHandler.RaiseP ostBackEvent(St ring eventArgument) +57
System.Web.UI.P age.RaisePostBa ckEvent(IPostBa ckEventHandler
sourceControl, String eventArgument) +18
System.Web.UI.P age.RaisePostBa ckEvent(NameVal ueCollection postData) +33
System.Web.UI.P age.ProcessRequ estMain() +1292


--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.432 2.2032; ASP.NET
Version:1.1.432 2.2032
ERROR END-----
Nov 18 '05 #1
1 2491
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,formatprovid er) 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

<configuratio n>
<system.web>
<globalizatio n
culture="en-US"
uiCulture="en-US"
....

you can set the culture by code to

System.Threadin g.Thread.Curren tThread.Current Culture =
System.Globaliz ation.CultureIn fo.CreateSpecif icCulture("en-US");
System.Threadin g.Thread.Curren tThread.Current UICulture =
System.Threadin g.Thread.Curren tThread.Current Culture;
--
Daniel Fisher(lennybac on)
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
2058
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 after a certain datetime and loggedout before another datetime. Any combination of these parameters can be used and, if none, returns all the log. Below is the code I came up with but I'm having a "Syntax error converting datetime from character...
1
2874
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- Date formats are different because of SQL Collation? 2- Do regional Settings affect Sql date format? 3- (Important) When inserting a datetime into first server there is no problem (15.12.2000 12:12:12) , but when I insert into second server (if...
4
32168
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 parseint64 after that to
3
21781
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 24 hr Format does not help.. making "hh" to "hhhh" Regards, Sugandh "John J. Hughes II" <invalid@nowhere.comwrote in message
4
3692
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 uses "." as seperator as used in Europe I have US regional setting and I have tried switching my regional setting to Europe
1
2608
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 make my comparisons easier. Or better yet, I want to start someting after a certain date.time and end when another date/time is met. Any ideas how to do this wihtout complicated
3
1000
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 MyDate = new DateTime(8, 4, 23);
5
5601
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 parses all double digit days fine. TIA JB
5
4728
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 stored with the same format. does datetime works fine for AM/PM format also? because some test conditions are failing , which i thought correct..Help me out! Thanks in advance..
0
8278
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8701
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8466
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8584
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7299
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6158
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5615
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4144
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4290
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.