ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   DateFormat (dd-mmm-yyyy) (dd-mmm-jjjj) Problem. (https://www.excelbanter.com/excel-programming/317898-dateformat-dd-mmm-yyyy-dd-mmm-jjjj-problem.html)

Venkatachalam

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.

Ron Rosenfeld

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

Venkatachalam

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


Ron Rosenfeld

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

Venkatachalam

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


Venkatachalam

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


Venkatachalam

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


Ron Rosenfeld

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


All times are GMT +1. The time now is 11:18 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com