473,721 Members | 1,806 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 5086

"Franck" <we**********@g mail.com> wrote in message
news:11******** **************@ g14g2000cwa.goo glegroups.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.ToDateT ime.

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.ToDateT ime
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********@hot mail.comREMOVET RAIL> wrote in message news:<eJ******* ******@TK2MSFTN GP15.phx.gbl>.. .
"Franck" <we**********@g mail.com> wrote in message
news:11******** **************@ g14g2000cwa.goo glegroups.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
67388
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 ex. the text file look like Name date Smith 20003112
19
7284
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. Specifically, I have a problem with this portion in the WHERE clause: DATEADD(Day,tblMyEventTableName.ReminderDays, @DateNow) Between CONVERT(smalldatetime,str(DATEPART(Month, @DateNow)+1) + '/' + str(DATEPART(Day, tblMyEventTableName.TaskDateTime)) + '/'...
4
5389
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 calculate days, months, and years. This is not for a college course. It's for my own personal genealogy website. I'm stumped about the code. I'm working on it but not making much progress. Is there any free code available anywhere? I know it...
1
6480
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. drop function mnaf_calc_calendar_quarter; CREATE FUNCTION mnaf_calc_calendar_quarter(pEndDate Date) --***************************************************************************** -- Name: mnaf_calc_calendar_quarter -- Description/Notes:
3
29038
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 week . I've used the weekday() function to convert dates to numberic days of the week (1-7) I've used cdbl (date) to convert a date to a serial number, but then I do math with the number and I can't seem to convert this back to a date.
1
4605
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 "dd/MM/yyyy" input as "01082003" convert to date value as, 01 Aug 2003 Example, User Defined Date Format as "yyyy,dd,MM"
17
71443
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
39336
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 will convert each of the records of these service dates to the first date of that month, with results showing: 7/1/2006, 7/1/2006, 7/1/2006. How would you place an expression on a query that will convert any given date to the first day of the month...
8
6053
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 app. 3. I need to convert the received date string in to a date w.r.t my local time zone.
0
8837
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8728
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
9366
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9059
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...
1
6668
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
5977
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
4484
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...
1
3187
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2572
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.