Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
change date format from dd/mm/yyyy to mm/yyyy flow23 Excel Discussion (Misc queries) 3 April 4th 23 11:26 AM
how do I change date from mm/dd/yyyy to dd:mm:yyyy format in Excel Jack Wilson New Users to Excel 4 July 18th 06 01:57 PM
change birthday display from mm/dd/yyyy to HIDE the yyyy? johnp Excel Worksheet Functions 1 May 9th 06 09:56 PM
Date problem (YYYY.MM.DD) LadyBonita Excel Worksheet Functions 1 December 2nd 05 11:05 PM
Having problem getting date into format: yyyy/mm/dd Andrew[_13_] Excel Programming 1 July 15th 03 09:49 PM


All times are GMT +1. The time now is 12:06 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"