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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DMY function - how to have the result in german language 3

Status
Not open for further replies.

kb281241

Technical User
Nov 14, 2010
4
DE
*Program-snippet:


CLEA
SET DATE GERMAN
SET CENTURY ON
? DMY(DATE())

*RETURNS 05 FEBRUARY 2011

*!*..BUT I WOULD LIKE TO SEE: 05 FEBRUAR 2011

*!* HOW TO DO?


 
Make your own function or use vfp9rdeu.dll


Borislav Borissov
VFP9 SP2, SQL Server 2000,2005 & 2008.
 
SET DATE GERMAN doesn't translate the date to German. It merely displays the date in the format commonly used in Germany (and most of Europe).

If your users have a German version of Windows, then SET DATE LONG will give you what you want. If not, do as Borislav suggested.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
With VFP9 there is a difference between doing DMY() in the IDE (within foxpro itself) and in the compiled exe. The exe will use the german runtime Borislav mentioned.

The IDE on the other side does use one of the
"C:\Program Files\Microsoft Visual FoxPro 9\VFP9KOR.DLL"
"C:\Program Files\Microsoft Visual FoxPro 9\VFP9CHS.DLL"
"C:\Program Files\Microsoft Visual FoxPro 9\VFP9CHT.DLL"
"C:\Program Files\Microsoft Visual FoxPro 9\VFP9ENU.DLL"
resource DLLs and since VFP8 or with VFP9 there was no german resource file and other languages like franch and spanish are only supported at runtime in an EXE as well within the IDE.

This means commands like DMY(), MONTH() and some others return english texts, even on a german Windows, but this changes, when the EXE finally uses the vfp9Rdeu.dll

If you want this within the IDE, you can buy a german localisation of the IDE here:
Mike Lewis is also right, that SET DATE LONG will use the OS date, and display it with weekday in german even within the english IDE.

Bye, Olaf.

PS Why not ask at dfpug.de or within
 
Thanks to all of you, guys.
I wondered about the result, as I had VFP 6.0 before I switched to VFP 9 prof. - and in VFP 6 I had the requested german date expression immediately.

Olaf, the reason that I asked here is, that since a long time I got so high qualified answers here, I had no reason to place my requests elsewhere so far - and as you can see, again I feel satisfied with your answers.

BTW - the SET DATE LONG command does NOT lead to the solution by running a *.prg-file it continues to show the english date expression.
 
the SET DATE LONG command does NOT lead to the solution by running a *.prg-file it continues to show the english date expression.

Not sure what you mean by "running a *.prg file".

But SET DATE LONG will show the date in German, but of course only if the user has set German as their preferred language in Control Panel (Regional Settings).

In fact (contrary to what I said), you don't need a German version of Windows.

Mike



__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
Mike,

I alos experimented a little further with it. Set date long is only caring for the systems control panel setting. If I SET DATE BRITISH and then SET DATE LONG I get the german date with weekday and month, as that is set in control panel, that even works, when SET SYSFORMATS OFF is issued beforehand.

But in control panel I can't set TTTT to display the weekday in another language, eg "Sunday" instead of "Sonntag". The same goes for MMMM (full month name) and MMM (short three letter month abbreviation). So it's surely also a matter of the windows languge or language pack installed and active.

Bye, Olaf.

 
Olaf,

But in control panel I can't set TTTT to display the weekday in another language, eg "Sunday" instead of "Sonntag". The same goes for MMMM (full month name) and MMM (short three letter month abbreviation).

I can't see exactly where you are doing that.

All I did was to go into "Regional and Language Options", then "Regional Options", then set the language to "German (Germany)" from the drop-down. That gave me a German-language date when I issued SET DATE GERMAN (this was in an English version of Windows XP). Are you talking about some other setting?

Of course, all this assumes that the original questioner wants to observe the user's Control Panel settings. If he always wants a German date, no matter what, then he should write his own function.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
I see now, what languageoption you used, there are several in the control panel.

I did use Regional and Language Options too, but there is an additonal button with extended options on the formats tab, where you can change formats like short and long date individually, at least in Vista.

I thought you talked about the language setting which would turn the whole windows into that other language.

Nevertheless all this does only work in conjunction with SET DATE LONG or SHORT, and is not at all working with SET DATE GERMAN alone. Do DMY(Date()) with SET DATE GERMAN, Mike, you'll not see german month names. No matter what you set up in the control panel. Control panel settings only come through in foxpro with SET DATE LONG or SET DATE SHORT.

I think kb281241 is already satisfied with the behavior of the german runtime, besides the prg problem, but that should be solved by including the prg into compilation.

Bye, Olaf.
 

I try to follow all your arguments - for which I have to thank you very much, and I think I am now just a little step away from understanding, but due to a translation problem I have to understand what your mentioned "control panel" means.

What I did, was - that I found unter "Tools-Options-Regional" some settings for system-setting (yes or no)as well as date, Time, century and numbers - but not any "set language to german" setting.

As my english is not the best, could you be so kind to tell me, how to call the "control-panel"?

Sorry for my little knowledge - I had a german VFP software 6.0 before I bought now version 9.0 because I would like to learn again more what has happened between that two versions, after some years of doing nothing with VFP.
 
First, the Control Panel is part of Windows, not FoxPro. It's where you make various settings to control how Windows operates. Maybe it's something like Systemsteuerung in German. Olaf can confirm that. He can also tell you where to find the regional settings in Control Panel. That's where you can set the language to German.

There's no "set language to German" in VFP.

In VFP, you can set the date format to German. That's what you do in Tools / Options / Regional. It's the same as executing SET DATE GERMAN in your program or from the Command window.

I know it can be difficult to understand all this, especially in a language other than your own.

Normally, this forum is operated entirely in English. But I'm sure other forum members won't object if Olaf answers your question in German in this case. I'm sure he can do that better than I can.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
I asked earlier, why don't you go into the german foxpro forums?

"control panel" is english for "Systemsteuerung". Part of Windows, not Foxpro, as Mike already explained.

SET DATE LONG and SHORT make foxpro use settings of windows to display dates, so this is an alternative to DMY(), but in regard to DMY() this does not change anything.

Bye, Olaf.

 
forgot two things:

DMY() is independant on SET DATE setttings, it only is influenced by SET CENTURY ON or OFF.

SET DATE LONG influences the display of Date values, eg ? DATE() or showing a date field in a textbox or report control.

Code:
SET DATE LONG
? Date()

In a german windows, this would display "Montag, 7. Februar 2011" at default settings, but you can modify via Windows control panel (Systemsteuerung) how it is displayed, eg with or without weekday, with month name or month short or month number or whatever you want.

And you can also change the language of the format, without changing the language of the whole windows system itself (this was the bit, that I didn't understood earlier).

Bye, Olaf.
 
I think kb281241 is already satisfied with the behavior of the german runtime, besides the prg problem, but that should be solved by including the prg into compilation.

Yes, Olaf, that is e.g. very valuable for me, because I could not imagine that when I played with VFP before I compiled my prg.

I learned a lot especially because I place my question here. (yes and my English knowledge too)

To answer why I do not use the German Forum - I think to learn the best way VFP is, to stay within the original language - which is English and that means to stay also with this forum.
This is the best way to avoid any translation errors which of course can happen in a forum where the language is other than English.

And as I said before - the discussion between you and Mike did
not stay on surface but went into depth - and that is, what I
see very often here.

In case that somebody wants to have things explained from German into English I hope that I help also - in fact that would be a pleasure for me.

Thanks again for your help.
 
OK, it's up to you. It's just I and other VFP experts like Jürgen Wondzinski are around in the german forums, too.

In regard to prg: Actually you can't avoid compiling a prg, it's always the compiled code, the fxp file, that runs. Nevertheless if some code runs in VFP, it uses the vfp9enu.dll resource DLL, as there is no vfp9deu.dll and if it runs in an EXE, it uses the vfp9Rdeu.dll resource DLL.

Check out _vfp.startmode. If that is 0 or 1 DMY() will return englisch month names, 2 or higher, depending on which vfp9Rxxx.dll is used and that can also be set by config.fpw or the -L command line option.

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top