Internal date format ME vs. other Windows versions 
Author Message
 Internal date format ME vs. other Windows versions

I've written some code to check how long ago my application was
installed and to bring up a prompt to register if it's over 30 days. In
the process I've discovered Windows ME works differently than Windows
98SE. Here are some sample outputs from the same program run on both
OSes. The install date is November 7, 2002 and the current date is
November 9, 2002 which should give a date difference result of 2 days.

Windows 98SE:
  InstallDate = 11/7/2002
  Today = Now: 11/9/2002 12:03:53 AM
  DateDiff(d, InstallDate, Today) =    2
  Today = Format(Date$, m/d/yyyy) 11/9/2002
  DateDiff(d, InstallDate, Today) =    2
  Today = Format(Date$, d/m/yyyy) 9/11/2002
  DateDiff(d, InstallDate, Today) =   -57
  Today = Format(Date$, mm/dd/yyyy) 11/9/2002
  DateDiff(d, InstallDate, Today) =    2
  Today = Format(Date$, dd/mm/yyyy) 9/11/2002
  DateDiff(d, InstallDate, Today) =   -57
  Today = Format(Date, m/d/yyyy) 11/9/2002
  DateDiff(d, InstallDate, Today) =    2
  Today = Format(Date, d/m/yyyy) 9/11/2002
  DateDiff(d, InstallDate, Today) =   -57
  Today = Format(Date, mm/dd/yyyy) 11/9/2002
  DateDiff(d, InstallDate, Today) =    2
  Today = Format(Date, dd/mm/yyyy) 9/11/2002
  DateDiff(d, InstallDate, Today) =   -57
  Today = Date$: 11/9/2002
  DateDiff(d, InstallDate, Today) =    2
  Today = Date: 11/9/2002
  DateDiff(d, InstallDate, Today) =    2
  Date$ = 11-09-2002
  DateDiff(d, InstallDate, Date$) =    2
  Date = 11/9/2002
  DateDiff(d, InstallDate, Date) =    2

Windows ME:
  InstallDate = 11/07/2002
  Today = Now: 09/11/2002 12:02:59 AM
  DateDiff(d, InstallDate, Today) =    121
  Today = Format(Date$, m/d/yyyy) 09/11/2002
  DateDiff(d, InstallDate, Today) =    121
  Today = Format(Date$, d/m/yyyy) 11/09/2002
  DateDiff(d, InstallDate, Today) =    62
  Today = Format(Date$, mm/dd/yyyy) 09/11/2002
  DateDiff(d, InstallDate, Today) =    121
  Today = Format(Date$, dd/mm/yyyy) 11/09/2002
  DateDiff(d, InstallDate, Today) =    62
  Today = Format(Date, m/d/yyyy) 11/09/2002
  DateDiff(d, InstallDate, Today) =    62
  Today = Format(Date, d/m/yyyy) 09/11/2002
  DateDiff(d, InstallDate, Today) =    121
  Today = Format(Date, mm/dd/yyyy) 11/09/2002
  DateDiff(d, InstallDate, Today) =    62
  Today = Format(Date, dd/mm/yyyy) 09/11/2002
  DateDiff(d, InstallDate, Today) =    121
  Today = Date$: 11/09/2002
  DateDiff(d, InstallDate, Today) =    62
  Today = Date: 09/11/2002
  DateDiff(d, InstallDate, Today) =    121
  Date$ = 11-09-2002
  DateDiff(d, InstallDate, Date$) =    62
  Date = 09/11/2002
  DateDiff(d, InstallDate, Date) =    121

Regional Settings on both computers are set to mm/dd/yyyy.

What I see here is on ME the month and day are reversed from the 98SE
format. There's also something odd about it never giving a correct date
difference calculation, possible a syntax error on my part but I can't
see it. Specifying the order of the numbers does affect the calculation,
that is, reversing the day and month changes how those values are
interpreted: the day becomes the month, and vice versa. I note there is
no format that works correctly for both SE and ME.

I wonder if anyone else has encountered this quirk, and if so what did
you do to deal with it?
--
Rod C--
Enterprise Network Consulting
Whitehorse, Yukon
http://www.*-*-*.com/

Quote:
>> If God wanted us to be brave, why did he give us legs?  -- Marvin Kitman <<

The preceding humor inserted by QuipSig
http://www.*-*-*.com/
4,000 quip repertory!


Thu, 28 Apr 2005 04:17:50 GMT  
 Internal date format ME vs. other Windows versions
I hope that's not your actual code.

For one, the interval portion of the DateDiff function is a string, so your
d should be "d".  Secondly, the second param of Format$ is also a string, so
should be in quotes.

If you post the actual code you're using, we can actually test it.

--

Randy Birch
MVP Visual Basic
http://www.mvps.org/vbnet/
Please respond only to the newsgroups so all can benefit.


| I've written some code to check how long ago my application was
| installed and to bring up a prompt to register if it's over 30 days. In
| the process I've discovered Windows ME works differently than Windows
| 98SE. Here are some sample outputs from the same program run on both
| OSes. The install date is November 7, 2002 and the current date is
| November 9, 2002 which should give a date difference result of 2 days.
|
| Windows 98SE:
|   InstallDate = 11/7/2002
|   Today = Now: 11/9/2002 12:03:53 AM
|   DateDiff(d, InstallDate, Today) =    2
|   Today = Format(Date$, m/d/yyyy) 11/9/2002
|   DateDiff(d, InstallDate, Today) =    2
|   Today = Format(Date$, d/m/yyyy) 9/11/2002
|   DateDiff(d, InstallDate, Today) =   -57
|   Today = Format(Date$, mm/dd/yyyy) 11/9/2002
|   DateDiff(d, InstallDate, Today) =    2
|   Today = Format(Date$, dd/mm/yyyy) 9/11/2002
|   DateDiff(d, InstallDate, Today) =   -57
|   Today = Format(Date, m/d/yyyy) 11/9/2002
|   DateDiff(d, InstallDate, Today) =    2
|   Today = Format(Date, d/m/yyyy) 9/11/2002
|   DateDiff(d, InstallDate, Today) =   -57
|   Today = Format(Date, mm/dd/yyyy) 11/9/2002
|   DateDiff(d, InstallDate, Today) =    2
|   Today = Format(Date, dd/mm/yyyy) 9/11/2002
|   DateDiff(d, InstallDate, Today) =   -57
|   Today = Date$: 11/9/2002
|   DateDiff(d, InstallDate, Today) =    2
|   Today = Date: 11/9/2002
|   DateDiff(d, InstallDate, Today) =    2
|   Date$ = 11-09-2002
|   DateDiff(d, InstallDate, Date$) =    2
|   Date = 11/9/2002
|   DateDiff(d, InstallDate, Date) =    2
|
|
| Windows ME:
|   InstallDate = 11/07/2002
|   Today = Now: 09/11/2002 12:02:59 AM
|   DateDiff(d, InstallDate, Today) =    121
|   Today = Format(Date$, m/d/yyyy) 09/11/2002
|   DateDiff(d, InstallDate, Today) =    121
|   Today = Format(Date$, d/m/yyyy) 11/09/2002
|   DateDiff(d, InstallDate, Today) =    62
|   Today = Format(Date$, mm/dd/yyyy) 09/11/2002
|   DateDiff(d, InstallDate, Today) =    121
|   Today = Format(Date$, dd/mm/yyyy) 11/09/2002
|   DateDiff(d, InstallDate, Today) =    62
|   Today = Format(Date, m/d/yyyy) 11/09/2002
|   DateDiff(d, InstallDate, Today) =    62
|   Today = Format(Date, d/m/yyyy) 09/11/2002
|   DateDiff(d, InstallDate, Today) =    121
|   Today = Format(Date, mm/dd/yyyy) 11/09/2002
|   DateDiff(d, InstallDate, Today) =    62
|   Today = Format(Date, dd/mm/yyyy) 09/11/2002
|   DateDiff(d, InstallDate, Today) =    121
|   Today = Date$: 11/09/2002
|   DateDiff(d, InstallDate, Today) =    62
|   Today = Date: 09/11/2002
|   DateDiff(d, InstallDate, Today) =    121
|   Date$ = 11-09-2002
|   DateDiff(d, InstallDate, Date$) =    62
|   Date = 09/11/2002
|   DateDiff(d, InstallDate, Date) =    121
|
| Regional Settings on both computers are set to mm/dd/yyyy.
|
| What I see here is on ME the month and day are reversed from the 98SE
| format. There's also something odd about it never giving a correct date
| difference calculation, possible a syntax error on my part but I can't
| see it. Specifying the order of the numbers does affect the calculation,
| that is, reversing the day and month changes how those values are
| interpreted: the day becomes the month, and vice versa. I note there is
| no format that works correctly for both SE and ME.
|
| I wonder if anyone else has encountered this quirk, and if so what did
| you do to deal with it?
| --
| Rod C--
| Enterprise Network Consulting
| Whitehorse, Yukon
| http://www.en-consult.ca/
|
| >> If God wanted us to be brave, why did he give us legs?  -- Marvin
Kitman <<
| The preceding humor inserted by QuipSig
| http://www.en-consult.ca/quipsig/
| 4,000 quip repertory!



Thu, 28 Apr 2005 07:12:32 GMT  
 Internal date format ME vs. other Windows versions
What I posted in the original message is the output to a debuglog file
which is why quotes were not included in the syntax. Here is the actual
code that generates that debuglog:
------------
If TblShoot And Detail_GetRegistry > 2 Then
  If IsDate(TempText) Then InstallDate = CDate(TempText)
  Print #TblShtFileNum, Nest; "InstallDate = "; InstallDate
  Today = Now
  Print #TblShtFileNum, Nest; "Today = Now: "; Today
  Print #TblShtFileNum, Nest; "DateDiff(d, InstallDate, Today) = ";
  Print #TblShtFileNum, Nest; DateDiff("d", InstallDate, Today)
  Today = Format(Date$, "m/d/yyyy")
  Print #TblShtFileNum, Nest; "Today = Format(Date$, m/d/yyyy) "; Today
  Print #TblShtFileNum, Nest; "DateDiff(d, InstallDate, Today) = ";
  Print #TblShtFileNum, Nest; DateDiff("d", InstallDate, Today)
  Today = Format(Date$, "d/m/yyyy")
  Print #TblShtFileNum, Nest; "Today = Format(Date$, d/m/yyyy) "; Today
  Print #TblShtFileNum, Nest; "DateDiff(d, InstallDate, Today) = ";
  Print #TblShtFileNum, Nest; DateDiff("d", InstallDate, Today)
  Today = Format(Date$, "mm/dd/yyyy")
  Print #TblShtFileNum, Nest; "Today = Format(Date$, mm/dd/yyyy) ";
Today
  Print #TblShtFileNum, Nest; "DateDiff(d, InstallDate, Today) = ";
  Print #TblShtFileNum, Nest; DateDiff("d", InstallDate, Today)
  Today = Format(Date$, "dd/mm/yyyy")
  Print #TblShtFileNum, Nest; "Today = Format(Date$, dd/mm/yyyy) ";
Today
  Print #TblShtFileNum, Nest; "DateDiff(d, InstallDate, Today) = ";
  Print #TblShtFileNum, Nest; DateDiff("d", InstallDate, Today)
  Today = Format(Date, "m/d/yyyy")
  Print #TblShtFileNum, Nest; "Today = Format(Date, m/d/yyyy) "; Today
  Print #TblShtFileNum, Nest; "DateDiff(d, InstallDate, Today) = ";
  Print #TblShtFileNum, Nest; DateDiff("d", InstallDate, Today)
  Today = Format(Date, "d/m/yyyy")
  Print #TblShtFileNum, Nest; "Today = Format(Date, d/m/yyyy) "; Today
  Print #TblShtFileNum, Nest; "DateDiff(d, InstallDate, Today) = ";
  Print #TblShtFileNum, Nest; DateDiff("d", InstallDate, Today)
  Today = Format(Date, "mm/dd/yyyy")
  Print #TblShtFileNum, Nest; "Today = Format(Date, mm/dd/yyyy) "; Today
  Print #TblShtFileNum, Nest; "DateDiff(d, InstallDate, Today) = ";
  Print #TblShtFileNum, Nest; DateDiff("d", InstallDate, Today)
  Today = Format(Date, "dd/mm/yyyy")
  Print #TblShtFileNum, Nest; "Today = Format(Date, dd/mm/yyyy) "; Today
  Print #TblShtFileNum, Nest; "DateDiff(d, InstallDate, Today) = ";
  Print #TblShtFileNum, Nest; DateDiff("d", InstallDate, Today)
  Today = Date$
  Print #TblShtFileNum, Nest; "Today = Date$: "; Today
  Print #TblShtFileNum, Nest; "DateDiff(d, InstallDate, Today) = ";
  Print #TblShtFileNum, Nest; DateDiff("d", InstallDate, Today)
  Today = Date
  Print #TblShtFileNum, Nest; "Today = Date: "; Today
  Print #TblShtFileNum, Nest; "DateDiff(d, InstallDate, Today) = ";
  Print #TblShtFileNum, Nest; DateDiff("d", InstallDate, Today)
  Print #TblShtFileNum, Nest; "Date$ = "; Date$
  Print #TblShtFileNum, Nest; "DateDiff(d, InstallDate, Date$) = ";
  Print #TblShtFileNum, Nest; DateDiff("d", InstallDate, Date$)
  Print #TblShtFileNum, Nest; "Date = "; Date
  Print #TblShtFileNum, Nest; "DateDiff(d, InstallDate, Date) = ";
  Print #TblShtFileNum, Nest; DateDiff("d", InstallDate, Date)
End If
------------

Quote:

> I hope that's not your actual code.

> For one, the interval portion of the DateDiff function is a string, so your
> d should be "d".  Secondly, the second param of Format$ is also a string, so
> should be in quotes.

> If you post the actual code you're using, we can actually test it.

> --

> Randy Birch
> MVP Visual Basic
> http://www.mvps.org/vbnet/
> Please respond only to the newsgroups so all can benefit.



> | I've written some code to check how long ago my application was
> | installed and to bring up a prompt to register if it's over 30 days. In
> | the process I've discovered Windows ME works differently than Windows
> | 98SE. Here are some sample outputs from the same program run on both
> | OSes. The install date is November 7, 2002 and the current date is
> | November 9, 2002 which should give a date difference result of 2 days.
> |
> | Windows 98SE:
> |   InstallDate = 11/7/2002
> |   Today = Now: 11/9/2002 12:03:53 AM
> |   DateDiff(d, InstallDate, Today) =    2
> |   Today = Format(Date$, m/d/yyyy) 11/9/2002
> |   DateDiff(d, InstallDate, Today) =    2
> |   Today = Format(Date$, d/m/yyyy) 9/11/2002
> |   DateDiff(d, InstallDate, Today) =   -57
> |   Today = Format(Date$, mm/dd/yyyy) 11/9/2002
> |   DateDiff(d, InstallDate, Today) =    2
> |   Today = Format(Date$, dd/mm/yyyy) 9/11/2002
> |   DateDiff(d, InstallDate, Today) =   -57
> |   Today = Format(Date, m/d/yyyy) 11/9/2002
> |   DateDiff(d, InstallDate, Today) =    2
> |   Today = Format(Date, d/m/yyyy) 9/11/2002
> |   DateDiff(d, InstallDate, Today) =   -57
> |   Today = Format(Date, mm/dd/yyyy) 11/9/2002
> |   DateDiff(d, InstallDate, Today) =    2
> |   Today = Format(Date, dd/mm/yyyy) 9/11/2002
> |   DateDiff(d, InstallDate, Today) =   -57
> |   Today = Date$: 11/9/2002
> |   DateDiff(d, InstallDate, Today) =    2
> |   Today = Date: 11/9/2002
> |   DateDiff(d, InstallDate, Today) =    2
> |   Date$ = 11-09-2002
> |   DateDiff(d, InstallDate, Date$) =    2
> |   Date = 11/9/2002
> |   DateDiff(d, InstallDate, Date) =    2
> |
> |
> | Windows ME:
> |   InstallDate = 11/07/2002
> |   Today = Now: 09/11/2002 12:02:59 AM
> |   DateDiff(d, InstallDate, Today) =    121
> |   Today = Format(Date$, m/d/yyyy) 09/11/2002
> |   DateDiff(d, InstallDate, Today) =    121
> |   Today = Format(Date$, d/m/yyyy) 11/09/2002
> |   DateDiff(d, InstallDate, Today) =    62
> |   Today = Format(Date$, mm/dd/yyyy) 09/11/2002
> |   DateDiff(d, InstallDate, Today) =    121
> |   Today = Format(Date$, dd/mm/yyyy) 11/09/2002
> |   DateDiff(d, InstallDate, Today) =    62
> |   Today = Format(Date, m/d/yyyy) 11/09/2002
> |   DateDiff(d, InstallDate, Today) =    62
> |   Today = Format(Date, d/m/yyyy) 09/11/2002
> |   DateDiff(d, InstallDate, Today) =    121
> |   Today = Format(Date, mm/dd/yyyy) 11/09/2002
> |   DateDiff(d, InstallDate, Today) =    62
> |   Today = Format(Date, dd/mm/yyyy) 09/11/2002
> |   DateDiff(d, InstallDate, Today) =    121
> |   Today = Date$: 11/09/2002
> |   DateDiff(d, InstallDate, Today) =    62
> |   Today = Date: 09/11/2002
> |   DateDiff(d, InstallDate, Today) =    121
> |   Date$ = 11-09-2002
> |   DateDiff(d, InstallDate, Date$) =    62
> |   Date = 09/11/2002
> |   DateDiff(d, InstallDate, Date) =    121
> |
> | Regional Settings on both computers are set to mm/dd/yyyy.
> |
> | What I see here is on ME the month and day are reversed from the 98SE
> | format. There's also something odd about it never giving a correct date
> | difference calculation, possible a syntax error on my part but I can't
> | see it. Specifying the order of the numbers does affect the calculation,
> | that is, reversing the day and month changes how those values are
> | interpreted: the day becomes the month, and vice versa. I note there is
> | no format that works correctly for both SE and ME.
> |
> | I wonder if anyone else has encountered this quirk, and if so what did
> | you do to deal with it?

Rod C--
Enterprise Network Consulting
Whitehorse, Yukon
http://www.en-consult.ca/

Quote:
>> Workaholics Anonymous---- THANK GOD IT'S MONDAY <<

The preceding humor inserted by QuipSig
http://www.en-consult.ca/quipsig/
4,000 quip repertory!


Thu, 28 Apr 2005 09:32:11 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. "Windows Internal Date Format"

2. Output format of date (using ActiveX Windows date time picker)

3. VS.Net Version vs .Net Framework version

4. TrueDBGrid Vs. Spread3.0 vs. Others

5. Get Windows version 3.1 vs. 3.11

6. US vs UK Date format

7. Isolate date format of Form from Windows setting ?

8. VB and Windows date formats

9. change the time&date format in windows

10. Date Format?Windows Problem

11. now() date format problem between NT and Windows 2000

12. Which date format is used by Windows ????

 

 
Powered by phpBB® Forum Software