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

Convert Date pb

Hi,
'm gettin mad about date conversion.
Here is the point.
Got and add-in for Excel which call functions from a web service (on a
remote server)
The remote server has regional settings set to "en-UK" and date to
dd/MM/yyyy. (I'can't change it !)
One of my function get a string as parameter and convert it to date in
the following format yyyy-mm-dd.
So, Having regional settings set to "fr-ch" (date format dd.mm.yyyy), I

call my function with "31/10/2003"... Works grate (with every date).
Changing regional settings to "en-US" and date to default "M/d/yyyy",
the function do not recognize the date.
I tried to set CurrentThread culture to a specific one, I tried
Date.Parse... I must miss somethin...
Is there a way to get back client date format during request and
convert the string date he filled to yyyy-mm-dd regarding this format ?

Help Please !

Nov 17 '05 #1
2 5052

"Franck" <we**********@gmail.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
Hi,
'm gettin mad about date conversion.
Here is the point.
Got and add-in for Excel which call functions from a web service (on a
remote server)
The remote server has regional settings set to "en-UK" and date to
dd/MM/yyyy. (I'can't change it !)
One of my function get a string as parameter and convert it to date in
the following format yyyy-mm-dd.
So, Having regional settings set to "fr-ch" (date format dd.mm.yyyy), I

call my function with "31/10/2003"... Works grate (with every date).
Changing regional settings to "en-US" and date to default "M/d/yyyy",
the function do not recognize the date.
I tried to set CurrentThread culture to a specific one, I tried
Date.Parse... I must miss somethin...
Is there a way to get back client date format during request and
convert the string date he filled to yyyy-mm-dd regarding this format ?

Help Please !


Given a date, you can try DateTime.Parse to return a date...

Let us know how it goes! :)

Mythran

Nov 17 '05 #2
The point is that I can figure out how the user filled the date...
All case worked with a Convert.ToDateTime.

31/12/2005 -> OK
31/12/05 -> OK
12/31/2005 -> OK
12/31/05 -> OK
BUT, when the user send an "ambiguous" date (5/1/2005 could be 5th of
Jan or 1st of May regarding regional date settings) here is
nightmare... If the user is in M/d/yyyy, the Convert.ToDateTime
convert in dd/MM/yyyy

SO, I'm trying to know user's date regional settings in order to make
the correct Date.Parse.

Help :(

"Mythran" <ki********@hotmail.comREMOVETRAIL> wrote in message news:<eJ*************@TK2MSFTNGP15.phx.gbl>...
"Franck" <we**********@gmail.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
Hi,
'm gettin mad about date conversion.
Here is the point.
Got and add-in for Excel which call functions from a web service (on a
remote server)
The remote server has regional settings set to "en-UK" and date to
dd/MM/yyyy. (I'can't change it !)
One of my function get a string as parameter and convert it to date in
the following format yyyy-mm-dd.
So, Having regional settings set to "fr-ch" (date format dd.mm.yyyy), I

call my function with "31/10/2003"... Works grate (with every date).
Changing regional settings to "en-US" and date to default "M/d/yyyy",
the function do not recognize the date.
I tried to set CurrentThread culture to a specific one, I tried
Date.Parse... I must miss somethin...
Is there a way to get back client date format during request and
convert the string date he filled to yyyy-mm-dd regarding this format ?

Help Please !


Given a date, you can try DateTime.Parse to return a date...

Let us know how it goes! :)

Mythran

Nov 17 '05 #3

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

Similar topics

1
by: Loi Tan Vo | last post by:
Hi, I have a text file that contains a date column. The text file will be imported to database in SQL 2000 server. After to be imported, I want to convert the date column to date type. For...
19
by: Lauren Quantrell | last post by:
I have a stored procedure using Convert where the exact same Convert string works in the SELECT portion of the procedure but fails in the WHERE portion. The entire SP is listed below....
4
by: Richard Hollenbeck | last post by:
I'm trying to write some code that will convert any of the most popular standard date formats twice in to something like "dd Mmm yyyy" (i.e. 08 Jan 1908) and compare the first with the second and...
1
by: Matt | last post by:
I would like to convert a couple informix stored procedures to SQL Server stored procedures. I have no idea how to accomplish this. Here is an example of one of the procedures I need to convert. ...
3
by: jerry.ranch | last post by:
I have a need to convert simple dates (i.e. 02/14/2005) to a number, do some math, and convert back to a date. (in a simple query). The math involves adding or substracting days, and days of the...
1
by: abcabcabc | last post by:
I write an application which can let user define own date format to input, How to convert the date string to date value with end-user defined date format? Example, User Defined Date Format as...
17
by: Terry Jolly | last post by:
New to C# ---- How do I convert a Date to int? In VB6: Dim lDate as long lDate = CLng(Date) In C#
4
by: perryclisbee via AccessMonster.com | last post by:
I have dates of service for several people that range all over each month. ie: patient had dates of service of: 7/3/2006, 7/24/2006 and 7/25/2006. I need to create a new field via a query that...
8
by: deepak_kamath_n | last post by:
Hello, I have the following scenario: 1. My application receives the date from another application as a string 2. The other application is running in a different time zone as compared to my...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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
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...
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...

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.