473,395 Members | 1,678 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,395 software developers and data experts.

A difference in date formats

Hi,
I have a difference between machines in the date formats they produce. This
one web application has this code. Me.txtRxDate.Text =
Now().ToShortDateString. On the development server, the browser displays
the date as: 2/27/2007
When I goto the production server, the same browser displays the date as:
2/27/07.

Where is this controled? It's not the "Regional and Langauge Settings",
both machines are set the same.

Greg
Feb 27 '07 #1
2 1221
On Feb 27, 6:12 pm, "gstark" <No-Re...@no-reply.comwrote:
Hi,
I have a difference between machines in the date formats they produce. This
one web application has this code. Me.txtRxDate.Text =
Now().ToShortDateString. On the development server, the browser displays
the date as: 2/27/2007
When I goto the production server, the same browser displays the date as:
2/27/07.

Where is this controled? It's not the "Regional and Langauge Settings",
both machines are set the same.

Greg
Can it be because of different culture settings?

What Culture do you use?

Example:

<globalization culture="en-US" uiCulture="en-US"/>

or

<%@ Page Language="C#" culture="en-US" uiCulture="en-US" />

--------------------------

you could also consider for Now().ToString("dd/MM/yyyy");

Feb 27 '07 #2
gstark wrote:
Hi,
I have a difference between machines in the date formats they produce. This
one web application has this code. Me.txtRxDate.Text =
Now().ToShortDateString. On the development server, the browser displays
the date as: 2/27/2007
When I goto the production server, the same browser displays the date as:
2/27/07.

Where is this controled? It's not the "Regional and Langauge Settings",
both machines are set the same.

Greg
It's controlled by the regional settings, but not the regional settings
of your user account. That's why you can't change it from the control panel.

IIS gets the culture settings from somewhere (perhaps an admin account,
I am not certain, and it has changed from version to version) and
creates a CultureInfo object for that culture and puts in
CultureInfo.CurrentCulture. That object is used for culture dependent
operations whenever you don't specify any culture.

You can create your own CultureInfo object and use for culture dependent
operations. You can also use CultureInfo.InvariantCulture for culture
neutral effect.

ToShortDateString doesn't have any override that takes a format
provider, but it is implemented exactly as ToString("d"), so you can use
the override of ToString that takes a format provider.

Example using a swedish culture info object, which will give the result
"2007-02-27":

Dim t As String = Now().ToString("d", new CultureInfo(1053))

--
Göran Andersson
_____
http://www.guffa.com
Feb 27 '07 #3

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

Similar topics

8
by: Gerrit Holl | last post by:
Posted with permission from the author. I have some comments on this PEP, see the (coming) followup to this message. PEP: 321 Title: Date/Time Parsing and Formatting Version: $Revision: 1.3 $...
26
by: Frank | last post by:
For my website i would like to display the age of my son in years, months, days and hours. For now i manage to get a result for totals. Like the total number of days. This is the beginning: ...
6
by: Jim Davis | last post by:
Before I reinvent the wheel I thought I'd ask: anybody got a code snippet that will convert the common ISO8601 date formats to a JS date? By "common" I mean at the least ones described in this...
9
by: SOLVER | last post by:
Hi, I can't figure out why this is not working propelly: date("d.m.Y",strtotime("05/03/2008 00:00:00")); result: 03.05.2008 date("d.m.Y",strtotime("18/05/2008 00:00:00")); result:...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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...
0
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...

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.