473,382 Members | 1,329 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Problem of ToOADate function

Hi All,

ToOADate can change a date value to a double value, but if I change
the Regional and Lauguage setting in control panel, for example,
change English(US) to English(Australia) , the same date time will get
different double values from function ToOADate. How to always get the
same double value no matter what setting is in control panel?

Thanks for the help!

Mar 15 '07 #1
5 2907
Hi Snow,

If you change English(US) to English(Australia), do you than change all your
individual dates as well?

11-1-2007 means in General English notation 11 January 2007 in USA English
it means November 1th 2007.

Cor

Cor

"snow" <ba**********@yahoo.comschreef in bericht
news:11**********************@e1g2000hsg.googlegro ups.com...
Hi All,

ToOADate can change a date value to a double value, but if I change
the Regional and Lauguage setting in control panel, for example,
change English(US) to English(Australia) , the same date time will get
different double values from function ToOADate. How to always get the
same double value no matter what setting is in control panel?

Thanks for the help!

Mar 15 '07 #2
On Mar 14, 10:40 pm, "Cor Ligthert [MVP]" <notmyfirstn...@planet.nl>
wrote:
Hi Snow,

If you change English(US) to English(Australia), do you than change all your
individual dates as well?

11-1-2007 means in General English notation 11 January 2007 in USA English
it means November 1th 2007.

Cor

Cor

"snow" <barbara_d...@yahoo.comschreef in berichtnews:11**********************@e1g2000hsg.go oglegroups.com...
Hi All,
ToOADatecan change a date value to a double value, but if I change
the Regional and Lauguage setting in control panel, for example,
change English(US) to English(Australia) , the same date time will get
different double values fromfunctionToOADate. How to always get the
same double value no matter what setting is in control panel?
Thanks for the help!- Hide quoted text -

- Show quoted text -
Hi Cor,

That is the reason caused the problem. I developed an application
program which plot the date and temperature in the spreadsheet. The
date on my computer, for example 3/4/2007, means March 4th, 2007 ,
English(US) setting. When the program runs on a customer's computer,
the same date changes to April, 3rd, 2007, English(Australia) setting.
The program reads the date from spreadsheet and changes date to double
value for plotting, the result is totally different. The date format
is defined by the computer system setting. The functin ToOADate should
know the system setting, but it seems alway taking mm/dd/yy format and
changes to double. So how to get the same double value from the date
on different time setting systems?

Mar 15 '07 #3
snow wrote:
<snip>
I developed an application
program which plot the date and temperature in the spreadsheet. The
date on my computer, for example 3/4/2007, means March 4th, 2007 ,
English(US) setting. When the program runs on a customer's computer,
the same date changes to April, 3rd, 2007, English(Australia) setting.
The program reads the date from spreadsheet and changes date to double
value for plotting, the result is totally different. The date format
is defined by the computer system setting. The functin ToOADate should
know the system setting, but it seems alway taking mm/dd/yy format and
changes to double. So how to get the same double value from the date
on different time setting systems?
It seems to me that the problem has nothing to do with ToOADate method
-- which just operates on the binaries of the current date value --
but in the date assignment itself.

Maybe you could provide the code that reads the data from the
spreadsheet, for that's where the problem lies in, I guess.

HTH.

Regards,

Branco.


Mar 15 '07 #4
On Mar 15, 10:45 am, "Branco Medeiros" <branco.medei...@gmail.com>
wrote:
snow wrote:

<snip>
I developed an application
program which plot the date and temperature in the spreadsheet. The
date on my computer, for example 3/4/2007, means March 4th, 2007 ,
English(US) setting. When the program runs on a customer's computer,
the same date changes to April, 3rd, 2007, English(Australia) setting.
The program reads the date from spreadsheet and changes date to double
value for plotting, the result is totally different. The date format
is defined by the computer system setting. ThefunctinToOADateshould
know the system setting, but it seems alway taking mm/dd/yy format and
changes to double. So how to get the same double value from the date
on different time setting systems?

It seems to me that the problem has nothing to do withToOADatemethod
-- which just operates on the binaries of the current date value --
but in the date assignment itself.

Maybe you could provide the code that reads the data from the
spreadsheet, for that's where the problem lies in, I guess.

HTH.

Regards,

Branco.
What my problem is the date setting. If the computer setting is
English(US), I have a date variable, for example myDate = #3/5/2007
12:00:00#, when I use myDate.ToOADate, I got a double value myDouble;
If the computer setting is English(Australia), myDate = #5/3/2007
12:00:00", which is the same date in different format, when I use
myDate.ToOADate, I got another double value myNew Double. myDouble
should be same as myNewDouble. so How to get same double value in
different time setting computer? is it a bug for function ToOADate?

Thanks!

Mar 19 '07 #5
snow wrote:
<snip>
What my problem is the date setting.
I don't thik so. Maybe I'm wrong, but your problem seems to be the way
you parse the date provided by the Excel spreadsheet.
If the computer setting is
English(US), I have a date variable, for example myDate = #3/5/2007
12:00:00#, when I use myDate.ToOADate, I got a double value myDouble;
If the computer setting is English(Australia), myDate = #5/3/2007
12:00:00", which is the same date in different format,
<snip>

Nope. The date literal uses the format #month/day/year#, regardless of
the cmputer's international settings.

Therefore, #5/3/2007#, regardless of the international settings, will
always represent the 3rd of may, 2007. And #3/5/2007# will always
represent the 5th of march, 2007. Two different dates, two different
doubles. Try it in both computers and you'll see.

Regards,

Branco.

Mar 19 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Emanuel Ziegler | last post by:
Hello, I want to do some mathematics with functions. In my case the function classes are very complex, but this simple example has the same problems. To allow calculations that begin with a...
117
by: Peter Olcott | last post by:
www.halting-problem.com
1
by: Mohamed Fysal | last post by:
I have written a Regular DLL with many Export Functions and one CALLBACK fun ction . The callback function declared in the .cpp file of the Regular DLL is as fol lows: typedef BOOL...
11
by: tohear | last post by:
ToOADate and FromOADate don't handle negative dates with time parts correctly. Negative dates with no time parts are OK. (Note: In COM date "zero" is 12/30/1899). Does anyone know if these are...
1
by: Kenny | last post by:
I am having issues with the "Date.ToOADate" method in VB .NET. I understand that in VB6 the function DateSerial gives an internal representation of the date. When I use the DateSerial method in...
12
by: Joel Byrd | last post by:
I'm having a little problem with using type-ahead functionality for an auto-suggest box. Sometimes, when I start to type something and the type-ahead shows up, the AJAX will send a request query...
2
by: Fernando Barsoba | last post by:
Dear all, I have been posting about a problem trying to encrypt certain data using HMAC-SHA1 functions. I posted that my problem was solved, but unfortunately, I was being overly optimistic. I...
2
by: Ken Varn | last post by:
I have a managed C++ method that I call from ASP.NET to set the time zone on the local box. I call SetTimeZoneInformation, which does not return an error, but the time zone remains unchanged. I...
1
by: =?Utf-8?B?RGFwcGVyRGFuSEBub3NwYW0ubm9zcGFt?= | last post by:
Given the example below, can someone explain why TimeSpan.TotalDays gives a different result than subtracting 2 DateTime.ToOADates? I am completely stumped. Thanks in advance, Dan Example...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.