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

Where does the short date format come from?

I've hit a snag with an application I wrote because of the differing
date formats in different countries.

It's a set of pages that make calls to a COM object that I have wrapped
in a web service. The COM object isn't mine, and it wants to receive
dates in a short date format, and it seems to inherit the localized
settings of it's host machine. The machine with that service/COM object
is in Canada and is set to use dd/mm/yyyy date format, and the server
with the pages is in the US and is using mm/dd/yyyy.

When I make calls to the web service, I'm converting the date sent in
using Date.ToShortDate (which I realize now was a bad decision). I
figured I could get around this by changing the pages server to use
dd/mm/yyyy via the Control Panel, but it seems to have no effect on the
short date being passed to the web service.

Does asp.net have a setting elsewhere that sets this? Any other ideas
(that don't require a code change)? Thanks!

Matt
Nov 19 '05 #1
3 1959
ToShortDateString uses the current thread's CultureInfo object. That class
defines the structure of dates, times, numbers, currency and a few things
about text. Every thread has one.

Since this issue also affects validators, take a look at the section
"Validators support for globalization" in my article at
http://aspalliance.com/699. It will give you specifics.

--- Peter Blum
www.PeterBlum.com
Email: PL****@PeterBlum.com
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx

"MattB" <so********@yahoo.com> wrote in message
news:3m*************@individual.net...
I've hit a snag with an application I wrote because of the differing date
formats in different countries.

It's a set of pages that make calls to a COM object that I have wrapped in
a web service. The COM object isn't mine, and it wants to receive dates in
a short date format, and it seems to inherit the localized settings of
it's host machine. The machine with that service/COM object is in Canada
and is set to use dd/mm/yyyy date format, and the server with the pages is
in the US and is using mm/dd/yyyy.

When I make calls to the web service, I'm converting the date sent in
using Date.ToShortDate (which I realize now was a bad decision). I figured
I could get around this by changing the pages server to use dd/mm/yyyy via
the Control Panel, but it seems to have no effect on the short date being
passed to the web service.

Does asp.net have a setting elsewhere that sets this? Any other ideas
(that don't require a code change)? Thanks!

Matt

Nov 19 '05 #2
Thanks! I think that set us straight (or at least in the right direction).

Matt

Peter Blum wrote:
ToShortDateString uses the current thread's CultureInfo object. That class
defines the structure of dates, times, numbers, currency and a few things
about text. Every thread has one.

Since this issue also affects validators, take a look at the section
"Validators support for globalization" in my article at
http://aspalliance.com/699. It will give you specifics.

--- Peter Blum
www.PeterBlum.com
Email: PL****@PeterBlum.com
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx

"MattB" <so********@yahoo.com> wrote in message
news:3m*************@individual.net...
I've hit a snag with an application I wrote because of the differing date
formats in different countries.

It's a set of pages that make calls to a COM object that I have wrapped in
a web service. The COM object isn't mine, and it wants to receive dates in
a short date format, and it seems to inherit the localized settings of
it's host machine. The machine with that service/COM object is in Canada
and is set to use dd/mm/yyyy date format, and the server with the pages is
in the US and is using mm/dd/yyyy.

When I make calls to the web service, I'm converting the date sent in
using Date.ToShortDate (which I realize now was a bad decision). I figured
I could get around this by changing the pages server to use dd/mm/yyyy via
the Control Panel, but it seems to have no effect on the short date being
passed to the web service.

Does asp.net have a setting elsewhere that sets this? Any other ideas
(that don't require a code change)? Thanks!

Matt


Nov 19 '05 #3

Couldn't you do some custom DateTime Format strings before you pass th
value along to the web service? If you search Visual Studio fo
"format datetime", there are some examples...

Ralp

--
rvira
-----------------------------------------------------------------------
rviray's Profile: http://www.msusenet.com/member.php?userid=421
View this thread: http://www.msusenet.com/t-187097517

Nov 19 '05 #4

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

Similar topics

1
by: kgatchell2001 | last post by:
Hi, I am a beginner working on a database to manage clients, payroll, station assignments, etc. I have created a query which calculates age based on subtracting the date of birth from the current...
16
by: Dixie | last post by:
I have a problem using Dev Ashish's excellent module to concatenate the results of a field from several records into one record. I am using the code to concatenate certain awards onto a...
7
by: Edward Mitchell | last post by:
I have a number of DateTimePicker controls, some set to dates, some set to a format of Time. The controls are all embedded in dialogs. I created the controls by dragging the DateTime picker from...
0
by: Phil | last post by:
My regional setting (on Win2000) is: (General Tab)Locale = English (US) (Date Tab), short date = MM/dd/yy When I ask .Net DateFormat.ShortDatePattern, I get MM/dd/yyyy Now, where does the...
3
by: CyberLotus | last post by:
Hi, I wish to validate the date a user has entered against the format dd-mmm-yyyy using the CompareValidator, but it does not work. Does anybody have a simple solution please? Many thanks...
6
by: ABC | last post by:
Is there any function return the short date format on the regional and Language Options under control panel?
2
by: savigliano | last post by:
hello, i am doing a date comparation and i have reallize that the data i have in my database (general date format) it is causing me problems, and because i donīt need the time data i would like to...
3
by: Matt Brown - identify | last post by:
Hello, I'm trying to figure out a method to look up by a range of dates, entries in a database. The format of the date in the database is "M\D \yyyy HH:MM:SS". What i need to do is take the...
5
OuTCasT
by: OuTCasT | last post by:
Hi. I would like to know how to convert the short date format to the long date format for my application without changing the regional settings from short date to long date. ?
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.