UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Fomat Date Mmm Yyyy And Show Different Language, Access 2010    
 
   
Aazzner
post Oct 2 2012, 08:06 AM
Post #1

UtterAccess Addict
Posts: 112



Hello all,

I have an application that switchs the data by the data in a text box.
I need to be able to see that date in English, Spanish, Chinese and Hungarian.

Is there a way to do it in VBA?

Thanks,

Aazzner
Go to the top of the page
 
+
DanielPineault
post Oct 2 2012, 08:56 AM
Post #2

UtterAccess VIP
Posts: 1,454



Whee you say see, do you mean display?

Have you look at the Format() function?

CODE
Format(date(),"yyyy-mm-dd") '2012-10-02
Format(date(),"yyyy-mmm-dd") '2012-Oct-02


and so on. Look at the help file lots more options and examples.
Go to the top of the page
 
+
Aazzner
post Oct 2 2012, 10:27 AM
Post #3

UtterAccess Addict
Posts: 112



If I am looking at 4/1/2012 - I want to see the following

English - APR 2012
Spanish - ABR 2012
Chinese - 四月 2012
Hungarian - ÁPR 2012

My problem is that this is a text box showing a formatted date and I use the date to change the data I am looking at.
So if I make it a string to show what I want - then I have to do other code to make it a date again.
I didn't know if there was a way to format it in a different language without going out and getting the translated month name and concatenating it with the year.

Thanks for all input (IMG:style_emoticons/default/smile.gif)
Go to the top of the page
 
+
DanielPineault
post Oct 2 2012, 11:47 AM
Post #4

UtterAccess VIP
Posts: 1,454



The format function will display the date as you specify using the locale settings of the computer running the db.

For instance, if you specify yyyy-mmm-dd for 2012-04-01

In US English you'll get 2012-Apr-01
but in Canada French you'll get 2012-avr-01

So it will adapt to the users setup.

That said, and I have done so in the past for certain projects, you can very easily build your own function to convert values between languages to override the local settings for whatever the reason.

I have also switch the local setting during the use of a program, and then set them back to there original value once it was closed. This however, is not a good idea generally because it will impact all the other programs running during this time and can lead to potential problems. So be careful if you go down this route for whatever reason.
Go to the top of the page
 
+
Aazzner
post Oct 3 2012, 05:52 AM
Post #5

UtterAccess Addict
Posts: 112



Daniel,

The application I have has the ability to switch languages no matter what locale you are in.
I test my app by switching to Chinese and making sure everthing is appropriately translated in the application.
I have not done anything to switch local at this point.
This is due to the fact that it was designed to have anyone from a different locale - be able to sit down at a computer next to me in the US and be able to use the application just like they were at home - except for the difference in the keyboard.
So it doesn't type in Chinese, but everything in the app is Chinese.

To sum up then - I just want to be able to display this date in whichever language happens to be picked, and still have it operate in English in the VBA code.

Aazzner
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 22nd May 2013 - 04:58 AM

Tag cloud: