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

Formatting Date Time Euro style

Hi

Probably a dumb question, but I'm having problems doing this for some
reason. I have a shortdate as datetime American Style (mm/dd/yy). I need to
convert it to a string that is in European format (dd/mm/yy).

I was hoping someone could help me out..

TIA

Steve
Nov 20 '05 #1
12 6850
Hi Steve

You can change how the Date is Displayed by using the Format Function.

Dim MyDate As Date = Now

Dim MyString As String

MyString = Format(MyDate, "dd/MM/yyyy")

MsgBox(MyString)

Make sure that you use capital M's (M) for the Month not lowercase m's (m)
as you may well find it returning Minutes rather than Months.

Hope this helps.

Neil Knobbe

Visual Basic MVP

"Steve Peterson" <sp*******@arrakis.es> wrote in message
news:ud**************@TK2MSFTNGP12.phx.gbl...
Hi

Probably a dumb question, but I'm having problems doing this for some
reason. I have a shortdate as datetime American Style (mm/dd/yy). I need to convert it to a string that is in European format (dd/mm/yy).

I was hoping someone could help me out..

TIA

Steve

Nov 20 '05 #2
* "Steve Peterson" <sp*******@arrakis.es> scripsit:
Probably a dumb question, but I'm having problems doing this for some
reason. I have a shortdate as datetime American Style (mm/dd/yy). I need to
convert it to a string that is in European format (dd/mm/yy).


I didn't know that there is a European date format. In Austria, we use
"dd.mm.yyyy".

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #3
OOPS! - I got it backwards.. Sorry..
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:c7************@ID-208219.news.uni-berlin.de...
* "Steve Peterson" <sp*******@arrakis.es> scripsit:
Probably a dumb question, but I'm having problems doing this for some
reason. I have a shortdate as datetime American Style (mm/dd/yy). I need to convert it to a string that is in European format (dd/mm/yy).


I didn't know that there is a European date format. In Austria, we use
"dd.mm.yyyy".

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 20 '05 #4
Wow! That's it? Geeez.. I was off on the "CultureInfo" & Iformatter trail.
The Help isn't too helpful (IMHP) on this subject...

Anyway - thnx! - it did the trick

Steve

"Neil Knobbe" <ac******@hotmail.com> wrote in message
news:uR**************@TK2MSFTNGP10.phx.gbl...
Hi Steve

You can change how the Date is Displayed by using the Format Function.

Dim MyDate As Date = Now

Dim MyString As String

MyString = Format(MyDate, "dd/MM/yyyy")

MsgBox(MyString)

Make sure that you use capital M's (M) for the Month not lowercase m's (m)
as you may well find it returning Minutes rather than Months.

Hope this helps.

Neil Knobbe

Visual Basic MVP

"Steve Peterson" <sp*******@arrakis.es> wrote in message
news:ud**************@TK2MSFTNGP12.phx.gbl...
Hi

Probably a dumb question, but I'm having problems doing this for some
reason. I have a shortdate as datetime American Style (mm/dd/yy). I
need to
convert it to a string that is in European format (dd/mm/yy).

I was hoping someone could help me out..

TIA

Steve


Nov 20 '05 #5
Herfried K. Wagner [MVP] wrote:
* "Steve Peterson" <sp*******@arrakis.es> scripsit:
Probably a dumb question, but I'm having problems doing this for some
reason. I have a shortdate as datetime American Style (mm/dd/yy). I
need to convert it to a string that is in European format (dd/mm/yy).


I didn't know that there is a European date format. In Austria, we
use "dd.mm.yyyy".


And in the Netherlands it's d-m-yyyy.

You can show and parse a date in the format for any culture, by using the
DateTime.ToString()/DateTime.Parse() overloads that take an IFormatProvider
parameter:

Dim USDate As String = "11/25/1981"
Dim NLDate As String
Dim D As Date = Date.Parse(USDate, _
System.Globalization.CultureInfo.CreateSpecificCul ture("en-US"))
NLDate = D.ToString("d", _
System.Globalization.CultureInfo.CreateSpecificCul ture("nl-NL"))

The value of NLDate will be "25-11-1981" after that.

--
Sven Groot

http://unforgiven.bloghorn.com

Nov 20 '05 #6
Hi Steve,

You can do a lot with those answers is it not.
(I took the date of tomorrow because 05-05-04 does not show to much)
Dim EuDate As String = _
Now.AddDays(1).ToString("dd-MM-yy")
Dim UsDate As String = _
Now.AddDays(1).ToString("MM-dd-yy")

I hope this helps?

Cor
Nov 20 '05 #7
Hi Herfried,

I didn't know that there is a European date format. In Austria, we use
"dd.mm.yyyy".


I thought they use in Austria also the EU format, however I seem to be
wrong.

day minutes year, definitly different from the rest in the EU

Cor
Nov 20 '05 #8
Hi Neil,

I made a message however did oversee your message

Sorry

Cor
Nov 20 '05 #9
Hi Sven,

And in the Netherlands it's d-m-yyyy.


In the netherlanths is not used days minutes year.

We use like the rest in Europe dd-MM-yy and dd-MM-yyyy
while the first was used before and the last after the millenium.
However that last will be everywhere on the world.

When we are writing we use of course as well long as short notations.

Cor

Nov 20 '05 #10
Cor Ligthert wrote:
Hi Sven,

And in the Netherlands it's d-m-yyyy.
In the netherlanths is not used days minutes year.


I know that small m is minutes in a format string, but since that wasn't the
solution I was giving him, that wasn't intended to be a real format string.
We use like the rest in Europe dd-MM-yy and dd-MM-yyyy
while the first was used before and the last after the millenium.
However that last will be everywhere on the world.
Who is "we"? In the Netherlands at least, the official date format is
d-M-yyyy, not dd-MM-yyyy. Even the Windows regional settings agree with me
on that. The difference is of course, that today is 5-5-2004, not
05-05-2004.
When we are writing we use of course as well long as short notations.


And the long notation for today is "woensdag 5 mei 2004".

The date format I prefer to use is still ISO: 2004-05-05

Japanese is also nice: 2004年5月5日
Which is also the output from my code if you ask it for culture "ja-JP" with
"D". I wonder if there's some way to make it say 平成16年5月5日 instead? (that's
using the Japanese years, this year is Heisei 16)

--
Sven Groot

http://unforgiven.bloghorn.com

Nov 20 '05 #11
On Wed, 5 May 2004 04:22:31 +0800, Neil Knobbe wrote:
Dim MyDate As Date = Now

Dim MyString As String

MyString = Format(MyDate, "dd/MM/yyyy")

MsgBox(MyString)


You can also do it even easier (IMO) this way:

MsgBox(MyDate.ToString("dd/MM/yyyy"))

--
Chris

To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
replace certain words in my E-Mail address.
Nov 20 '05 #12
* Chris Dunaway <"dunawayc[[at]_lunchmeat_sbcglobal[dot]]net"> scripsit:
On Wed, 5 May 2004 04:22:31 +0800, Neil Knobbe wrote:
Dim MyDate As Date = Now

Dim MyString As String

MyString = Format(MyDate, "dd/MM/yyyy")

MsgBox(MyString)


You can also do it even easier (IMO) this way:

MsgBox(MyDate.ToString("dd/MM/yyyy"))


Or: 'MsgBox(Now.ToString(...))' ;-).

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #13

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

Similar topics

4
by: Dan Weeb | last post by:
Hi All, I have struggled through this far with help from many of you so thanks. I am stuck again. I am really new to this so don't be harsh :-) There are a few problems. You can run the script...
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 $...
7
by: LineVoltageHalogen | last post by:
Greetings All, I was hoping that someone might be able to help me with the following issue: table ddl: create table exchange ( exchangefrom varchar(6), exchangeto varchar(6),...
4
by: Peter Bailey | last post by:
I have a vba string taht dynamically creates the query which has two dates in it that it grabs off an open form as a string from the textbox. What I generate in vba is: SELECT DOSMBK.Date,...
0
by: ashish | last post by:
hi All, Iam having a webapplication which when run under French culture info displays value of euro currency in this format 0.00 E, (E being the euro symbol, dont know how to type it here ) ...
4
by: Arthur Dent | last post by:
Hello all, ive been programming with ASP.NET since it came out, but am just getting my feet with now with v.2. Ive noticed something strange in the way my HTML tables get rendered with 2. I use...
25
by: mdh | last post by:
Hi Group, Not looking for an answer, but more of an explanation. Thinking back to those heady days when you had the time to do them, may I ask this. Exercise 1-22 asks for a program to "fold"...
4
by: Ken Wigle | last post by:
All, I would be very grateful for any help on this question. I have an application in asp.net 2.0 where I dynamically create a datatable and then bind that to a gridview. Unfortunately, the...
17
by: Petyr David | last post by:
Just looking for the simplest. right now my perl script returns an error messge to the user if the date string is invalid. would like to do this before accessing the server. TX
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: 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: 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:
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...
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...
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.