catalyst2 community forums  

Go Back   catalyst2 community forums > New Users > How-To?

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
Old 26-12-2004, 11:35 PM   #1 (permalink)
Registered User
 
Join Date: Oct 2004
Posts: 31
The Date Devil

personally i hate dates.......more pages have been dedicated to the utter confusion caused by dates and regional settings than to the Iraq war

and its still confusin


ok my problem...british site.......take the date in in british format

fine on my machine

up here i get this

[InvalidCastException: Cast from string "28/02/1972" to type 'Date' is not valid.]
Microsoft.VisualBasic.CompilerServices.DateType.Fr omString(String Value, CultureInfo culture) +162
Microsoft.VisualBasic.CompilerServices.DateType.Fr omString(String Value) +53
WDate.UserRegister.btnRegister_Click(Object sender, ImageClickEventArgs e) +396



ok so i believe that the vb.net function cdate takes its setting from the server its running from, but then i am sure paul and his team will have set the server up as british

anyone any advice?
DateWifaDiff is offline   Reply With Quote
Old 27-12-2004, 12:06 AM   #2 (permalink)
Registered User
 
Join Date: Oct 2004
Posts: 31
ok tried a few thangs

put a label into the page to show me LCID

my machine
Default LCID is: 2057 Date format is: 27/12/2004 00:01:41

cat server
Default LCID is: 1033 Date format is: 12/27/2004 12:01:12 AM

gonna try messing with the web-config.........can't remember where i got the one thats with the site up here........just know its different from my own machine

<globalization requestEncoding="windows-1252" responseEncoding="windows-1252" fileEncoding="windows-1252" culture="en-US" uiCulture="en-US" />


going to try changing to en-GB
DateWifaDiff is offline   Reply With Quote
Old 27-12-2004, 12:12 AM   #3 (permalink)
Registered User
 
Join Date: Oct 2004
Posts: 31
problem sorted :-)

so looks like the settings in your web.config over ride whatever the local settings for the server are
DateWifaDiff is offline   Reply With Quote
Old 09-01-2005, 08:04 PM   #4 (permalink)
Registered User
 
Join Date: Feb 2004
Posts: 17
Also, another way of making really sure is to put code in the Application_BeginRequest method within the global.asax application overriding the default UI Culture with a new CultureInfo object.

For example, in my application (which is multilingual) i do the following.

Code:
protected void Application_BeginRequest(Object sender, EventArgs e)
{
	try
	{
		CultureInfo cultureInfo;

		if(SessionManager.ItemExists("UICulture"))
		{
			cultureInfo = new CultureInfo(SessionManager.GetItem("UICulture").ToString());
		}
		else
		{
			cultureInfo = new CultureInfo(HttpContext.Current.Request.UserLanguages[0]);
		}

		Thread.CurrentThread.CurrentUICulture = cultureInfo;
	}
	catch //not too fussed about catching any specific exception
	{
		Thread.CurrentThread.CurrentUICulture = new CultureInfo(ConfigManager.GetItem("Locale.DefaultCulture"));
	}
}
Gimlet is offline   Reply With Quote
Old 09-01-2005, 08:25 PM   #5 (permalink)
Registered User
 
Waldovia PM's Avatar
 
Join Date: Jul 2003
Location: West Midlands
Posts: 188
You chaps seem to be putting in an awful lot of work to make dates meet individual requirements.
If only people would conform to ISO 8601 there would be no problem.

YEAR-MONTH-DAY-HOUR-MINUTE-SECOND

ISO 8601
Waldovia PM is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 06:34 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.