Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
DateFormat (dd-mmm-yyyy) (dd-mmm-jjjj) Problem.
Hi All,
I am using Borland C++ application (An exe application) to get data form the Database and populating data to Excel with some formating. In order to format a cell in the excel as date, I am using Cell.OlePropertySet("NumberFormat", "dd-mmm-yyyy"); It is working fine with US locale setting. When a user with Dutch(Netherlands) locale uses the same application, then the date displays something like "06-jan-YYYY". The reason because Excel understands year only if it is j in Dutch(Netherlands). ie Cell.OlePropertySet("NumberFormat", "dd-mmm-jjjj"); Now my question is, how can I make it work across all country users?. Please let me know. Thanks in advance. With Regs Venkat. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
DateFormat (dd-mmm-yyyy) (dd-mmm-jjjj) Problem.
On Sat, 27 Nov 2004 09:03:03 -0800, "Venkatachalam"
wrote: Hi All, I am using Borland C++ application (An exe application) to get data form the Database and populating data to Excel with some formating. In order to format a cell in the excel as date, I am using Cell.OlePropertySet("NumberFormat", "dd-mmm-yyyy"); It is working fine with US locale setting. When a user with Dutch(Netherlands) locale uses the same application, then the date displays something like "06-jan-YYYY". The reason because Excel understands year only if it is j in Dutch(Netherlands). ie Cell.OlePropertySet("NumberFormat", "dd-mmm-jjjj"); Now my question is, how can I make it work across all country users?. Please let me know. Thanks in advance. With Regs Venkat. I'm not sure of the usage of OlePropertSet, but perhaps you could use either "NumberFormatLocal" or "Short Date" in your argument list. At least in Excel VBA, both of those should be aware of the regional settings. --ron |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
DateFormat (dd-mmm-yyyy) (dd-mmm-jjjj) Problem.
Hi Ron,
Thanks for your reply. Still the problem exists. Even If I specify as NumberFormatLocal, still my application try to set data format as dd-mm-yyyy and in the different locale (In my case Dutch-Netherlands), excel is not understanding yyyy ment for year and it display in the excel sheet yyyy as it is, in stead of displaying 4 digit year. If I specify jjjj, then it works fine, but problem with the English-US settings. Do I have any way to get the current locale date signature from "EXCEL", so that I can get the date signature during the run time and based on that I can decided to use YYYY or jjjj or whatever it may be, based on the current locale settings. Thanks With Regs Venkat "Ron Rosenfeld" wrote: On Sat, 27 Nov 2004 09:03:03 -0800, "Venkatachalam" wrote: Hi All, I am using Borland C++ application (An exe application) to get data form the Database and populating data to Excel with some formating. In order to format a cell in the excel as date, I am using Cell.OlePropertySet("NumberFormat", "dd-mmm-yyyy"); It is working fine with US locale setting. When a user with Dutch(Netherlands) locale uses the same application, then the date displays something like "06-jan-YYYY". The reason because Excel understands year only if it is j in Dutch(Netherlands). ie Cell.OlePropertySet("NumberFormat", "dd-mmm-jjjj"); Now my question is, how can I make it work across all country users?. Please let me know. Thanks in advance. With Regs Venkat. I'm not sure of the usage of OlePropertSet, but perhaps you could use either "NumberFormatLocal" or "Short Date" in your argument list. At least in Excel VBA, both of those should be aware of the regional settings. --ron |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
DateFormat (dd-mmm-yyyy) (dd-mmm-jjjj) Problem.
On Sun, 28 Nov 2004 07:47:02 -0800, "Venkatachalam"
wrote: Hi Ron, Thanks for your reply. Still the problem exists. Even If I specify as NumberFormatLocal, still my application try to set data format as dd-mm-yyyy and in the different locale (In my case Dutch-Netherlands), excel is not understanding yyyy ment for year and it display in the excel sheet yyyy as it is, in stead of displaying 4 digit year. If I specify jjjj, then it works fine, but problem with the English-US settings. Do I have any way to get the current locale date signature from "EXCEL", so that I can get the date signature during the run time and based on that I can decided to use YYYY or jjjj or whatever it may be, based on the current locale settings. Did you try "Short Date" ? In Excel VBA, that is an acceptable argument for NumberFormat --ron |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
DateFormat (dd-mmm-yyyy) (dd-mmm-jjjj) Problem.
Hi Ron,
I never tried "short date", because, I need to use more that one such date format. For eg (dd-mmm-yyyy, dd-yyyy-mmm, yyyy-mmm-yyyy, etc). Is it possible to get date Signature of MS-EXCEL, by any chance? Thanks With Regs Venkat "Ron Rosenfeld" wrote: On Sun, 28 Nov 2004 07:47:02 -0800, "Venkatachalam" wrote: Hi Ron, Thanks for your reply. Still the problem exists. Even If I specify as NumberFormatLocal, still my application try to set data format as dd-mm-yyyy and in the different locale (In my case Dutch-Netherlands), excel is not understanding yyyy ment for year and it display in the excel sheet yyyy as it is, in stead of displaying 4 digit year. If I specify jjjj, then it works fine, but problem with the English-US settings. Do I have any way to get the current locale date signature from "EXCEL", so that I can get the date signature during the run time and based on that I can decided to use YYYY or jjjj or whatever it may be, based on the current locale settings. Did you try "Short Date" ? In Excel VBA, that is an acceptable argument for NumberFormat --ron |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
DateFormat (dd-mmm-yyyy) (dd-mmm-jjjj) Problem.
Hi Ron,
Let me explain my problem in detail, so that you can understand easily. In the code I am setting Date format as dd-mmm-yyy in English-US locale. After creating the exe as package, and give it to other users. Now if a Dutch-Netherlands user runs the application, even now my application try to set the date format as dd-mmm-yyyy for Excel during the runtime. But Excel expects dd-mmm-jjjj. I can check for locale, if it is English-US then I can use dd-mmm-yyy and if Dutch-Netherlands then dd-mmm-yyyy. I don't want to use this style coding, because, tomorrow someother locale user uses this application, then he will also face this problem and need code change, so I am looking for a generic solution. Thanks With regards Venkat "Venkatachalam" wrote: Hi Ron, I never tried "short date", because, I need to use more that one such date format. For eg (dd-mmm-yyyy, dd-yyyy-mmm, yyyy-mmm-yyyy, etc). Is it possible to get date Signature of MS-EXCEL, by any chance? Thanks With Regs Venkat "Ron Rosenfeld" wrote: On Sun, 28 Nov 2004 07:47:02 -0800, "Venkatachalam" wrote: Hi Ron, Thanks for your reply. Still the problem exists. Even If I specify as NumberFormatLocal, still my application try to set data format as dd-mm-yyyy and in the different locale (In my case Dutch-Netherlands), excel is not understanding yyyy ment for year and it display in the excel sheet yyyy as it is, in stead of displaying 4 digit year. If I specify jjjj, then it works fine, but problem with the English-US settings. Do I have any way to get the current locale date signature from "EXCEL", so that I can get the date signature during the run time and based on that I can decided to use YYYY or jjjj or whatever it may be, based on the current locale settings. Did you try "Short Date" ? In Excel VBA, that is an acceptable argument for NumberFormat --ron |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
DateFormat (dd-mmm-yyyy) (dd-mmm-jjjj) Problem.
Hi Ron,
The problem is solved. I have to use YEAR_SIGN = pXL.OlePropertyGet("International", 19 /*xlYearCode*/);, which returns the year code, based on the Locale. I.e., Y (English-US) or j (Dutch-Netherlnnds). Thanks for your efforts. With Best Regards Venkat. "Venkatachalam" wrote: Hi Ron, Let me explain my problem in detail, so that you can understand easily. In the code I am setting Date format as dd-mmm-yyy in English-US locale. After creating the exe as package, and give it to other users. Now if a Dutch-Netherlands user runs the application, even now my application try to set the date format as dd-mmm-yyyy for Excel during the runtime. But Excel expects dd-mmm-jjjj. I can check for locale, if it is English-US then I can use dd-mmm-yyy and if Dutch-Netherlands then dd-mmm-yyyy. I don't want to use this style coding, because, tomorrow someother locale user uses this application, then he will also face this problem and need code change, so I am looking for a generic solution. Thanks With regards Venkat "Venkatachalam" wrote: Hi Ron, I never tried "short date", because, I need to use more that one such date format. For eg (dd-mmm-yyyy, dd-yyyy-mmm, yyyy-mmm-yyyy, etc). Is it possible to get date Signature of MS-EXCEL, by any chance? Thanks With Regs Venkat "Ron Rosenfeld" wrote: On Sun, 28 Nov 2004 07:47:02 -0800, "Venkatachalam" wrote: Hi Ron, Thanks for your reply. Still the problem exists. Even If I specify as NumberFormatLocal, still my application try to set data format as dd-mm-yyyy and in the different locale (In my case Dutch-Netherlands), excel is not understanding yyyy ment for year and it display in the excel sheet yyyy as it is, in stead of displaying 4 digit year. If I specify jjjj, then it works fine, but problem with the English-US settings. Do I have any way to get the current locale date signature from "EXCEL", so that I can get the date signature during the run time and based on that I can decided to use YYYY or jjjj or whatever it may be, based on the current locale settings. Did you try "Short Date" ? In Excel VBA, that is an acceptable argument for NumberFormat --ron |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
DateFormat (dd-mmm-yyyy) (dd-mmm-jjjj) Problem.
On Sun, 28 Nov 2004 22:55:02 -0800, "Venkatachalam"
wrote: The problem is solved. Glad to hear that. As you have discovered, there are often several ways to solve an Excel problem. --ron |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
change date format from dd/mm/yyyy to mm/yyyy | Excel Discussion (Misc queries) | |||
how do I change date from mm/dd/yyyy to dd:mm:yyyy format in Excel | New Users to Excel | |||
change birthday display from mm/dd/yyyy to HIDE the yyyy? | Excel Worksheet Functions | |||
Date problem (YYYY.MM.DD) | Excel Worksheet Functions | |||
Having problem getting date into format: yyyy/mm/dd | Excel Programming |