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

Date conversion

My regional setting is "yy-MM-dd" for the date

But for my application I have to use the format date "dd/MM/yyyy"
I convert the date to dd/MM/yyyy with this code :

m_curSel.ToString("dd/MM/yyyy")

But I have error : "Cast of the string "23-12-2004" in type Date is non
valide"

WHY ?

Another question : it's possible to use date variable independing of
the regional setting of the PC

--
Ceci est une signature automatique de MesNews.
Site : http://www.mesnews.net

Nov 21 '05 #1
2 1888
"bnob" <bn**@bluewin.ch> schrieb:
My regional setting is "yy-MM-dd" for the date

But for my application I have to use the format date "dd/MM/yyyy"
I convert the date to dd/MM/yyyy with this code :

m_curSel.ToString("dd/MM/yyyy")
Is 'm_curSel' a 'Date' variable?

Your code works fine for me. If you want to use the "/" character as
separator:

\\\
MsgBox(Date.Now.ToString("dd\/MM\/yyyy"))
///
But I have error : "Cast of the string "23-12-2004" in type Date is non
valide"
I don't see where you cast a string into a date. Your code is converting a
date to a string, I assume. You can use 'DateTime.ParseExact' to convert a
date string that is in a specific format into a date.
Another question : it's possible to use date variable independing of the
regional setting of the PC


'Date' is independent from regional settings. Both, 'DateTime.ParseExact'
and 'DateTime.ToString' can be used to parse/output date strings by
specifying a certain date format string.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #2
Bnob,

In addition to Herfried (how is it possible about dates).

Your email adres is in Swiss, so you make me curious. I have always seen
there dates as "dd-MM-yyyy" is that changed the last months?

However when your culture setting is still the as the rest from Europe, than
you can use to make it culture independent by using

dim mystring as string = date.now.tostring("d")

I hope this helps

Cor

"bnob" <bn**@bluewin.ch>

But for my application I have to use the format date "dd/MM/yyyy"
I convert the date to dd/MM/yyyy with this code :

m_curSel.ToString("dd/MM/yyyy")

But I have error : "Cast of the string "23-12-2004" in type Date is non
valide"

WHY ?

Another question : it's possible to use date variable independing of the
regional setting of the PC

--
Ceci est une signature automatique de MesNews.
Site : http://www.mesnews.net

Nov 21 '05 #3

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

Similar topics

3
by: praba kar | last post by:
Dear All, I have doubt regarding date string to time conversion function. In Python I cannot find flexible date string conversion function like php strtotime. I try to use following type...
1
by: Riley DeWiley | last post by:
I have an UPDATE query that is always setting 0 records. When I cut and paste the SQL into Access and use it, it fails in the same way unless I coerce the date fields to be '=now()', in which case...
1
by: Franck | last post by:
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...
10
by: melissa.nava | last post by:
Here is my code: ***** Public Property DOB() As Date Get Try DOB = (msBirthMonth + "/" + msBirthDay + "/" + msBirthYear)
8
by: no_spam_for_gman | last post by:
Hi, Has anybody ever created a DB2 date function to convert a JDEdwards date to a db2 date? Example: September 28 is 106271 in JDEdwards.
44
by: user | last post by:
Hi, Let's say I have 2 dates in the b/m format: Date 1 and date 2 How do I check whether Date2 is later than Date 1? Date1. 21-Nov-2006 09:00:00 PM
10
by: =?Utf-8?B?TWlrZQ==?= | last post by:
I have a string variable containing a date formatted as YYYYMMDD For example - Dim x as string = "20070314" If I try to perform a type conversion as follows I get an error: Dim y as Date =...
1
by: vadala | last post by:
The requirement is to send start data and end date from java to UI (.net) for a functionality. We are setting the time in java (1.5) before handing it over to WebService (sending to UI ) in...
7
by: bruce.dodds | last post by:
Access seems to be handling a date string conversion inconsistently in an append query. The query converts a YYYYMM string into a date, using the following function: CDate(Right(,2) & "/1/" &...
2
by: RN1 | last post by:
A TextBox displays the current date (in dd/mm/yyyy format) & time when a user comes to a page (e.g. 15/10/2008 1:36:39 PM). To convert the date into international format so that the remote server...
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
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: 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
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.