Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

date formatting to either US or European format !!!!

Status
Not open for further replies.

blom0344

Technical User
Mar 20, 2002
3,441
NL
Dear All,

I use a calenderfile to populate 2 date fields with an actionbutton. When I choose 3 january 2003 then the contents of the textbox is formatted in the US way:
01-03-2003. Choosing 17 januari results in the European format : 17-1-2003.
I have tried every possible formatting type and regional setting, but the problem persists. Does anyone have the trick to force all possible dates to either the US or European style,cause this is unworkable....
T. Blom
Information analyst
tbl@shimano-eu.com
 
Presumably when you say choose a date, you have some kind of event, which puts the date into the text box?

In this event, you could do:
Code:
Me.txtTextBox.Value = Format(Me.Calender.Value, "dd/mm/yyyy")

.....Or have I utterly missed the point ;-)
 
Hello Mincefish,

You are on the mark there, but I already tried your idea.
I solved it however, cause in the piece of code I borrowed was a concatenation of the month&day&year which I switched to day&month&year and voila, it is all now in European style................ T. Blom
Information analyst
tbl@shimano-eu.com
 
I do not know how your calendar file is built up, but you may find data literals come in handy. A date literal is an american formatted date between number signs. This is also the way a date variable should be filled with a hardcoded value. So suppose you'd want to set a variable to Jan 3rd, 2001 regardless of the regional settings, you'd use the following code:

Code:
dtmSomeVariable=#1/3/2001#

Do not be surprised if the editor shows this in your own local settings when you press ENTER.

Best regards
 
Hi Blom,
Can you post youir code for US or Uk format of date ?
Thanks
Fule
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top