Date bug

G

Guest

I've reported time display bugs here before, e.g. in Task Scheduler and
SyncToy. The date presented is not according to my format (dd-mm-yyyy) in
Regional Settings. I can live with it, although I hope it can be fixed.

However, today I restarted my PC and the Uptime gadget
http://gallery.microsoft.com/LiveItemDetail.aspx?li=9edd60d7-5810-44b4-a72e-b3416de5758b&l=1
suddenly shows an uptime of 293 days. I have been using Uptime for about a
week now and it has been accurate until now. (Note: I am not sure if this is
a problem in the gadget or Vista reporting incorrect data to the gadget.)

Anyway, I have spent some time figuring out where this comes from. I think I
found a reason:
Today is December 02, 2006. Coincidentally (?) 293 days ago is February 12,
2006. So, to me there seems to be a confusion between 02-12-2006 and
12-02-1006. It probably only happens when DD-MM and MM-DD are both valid
dates. That explains why I didn't have that problem with Uptime during the
end of November.

Again, not sure whether this is a problem with Vista or the gadget but my
wild guess would be: Vista.
 
G

Guest

My Uptime gadget is doing the same thing! I'm on RC2 at the moment

I've been able to solve it. It seems the gadget is not intelligent enough
and it doesn't consider locales in the dd-mm-yyyy format. For a quick fix:

1. Go to the folder:
"C:\Users\<username>\AppData\Local\Microsoft\Windows
Sidebar\Gadgets\Uptime.gadget\en-US\core"

2. Make a backup copy of core.framework.vbs

3. Open core.framework.vbs in Notepad by rightclicking followed by Edit

4. Replace
Function WMIDateStringToDate(dtmBootup)

WMIDateStringToDate = CDate(Mid(dtmBootup, 5, 2) & "/" & _
Mid(dtmBootup, 7, 2) & "/" & Left(dtmBootup, 4) _
& " " & Mid (dtmBootup, 9, 2) & ":" & _
Mid(dtmBootup, 11, 2) & ":" & Mid(dtmBootup,13, 2))

End Function

by

Function WMIDateStringToDate(dtmBootup)

WMIDateStringToDate = CDate(Mid(dtmBootup, 7, 2) & "/" & _
Mid(dtmBootup, 5, 2) & "/" & Left(dtmBootup, 4) _
& " " & Mid (dtmBootup, 9, 2) & ":" & _
Mid(dtmBootup, 11, 2) & ":" & Mid(dtmBootup,13, 2))

End Function

5. Save core.framework.vbs

6. Open a new instance of Uptime from the gadget gallery.

7. Done


Note: the only thing that's different in step 4 between the two functions is
5 and 7 being swapped. This corrects the dd-mm and mm-dd format.

The place where it goes wrong is in the line
dtmSystemUptimeSecs = DateDiff("s", dtmLastBootUpTime, Now)
because the Now format changes based on the locale settings. By changing
dtmLastBootupTime accordingly, the date difference remains correct.

This only works when your short date in Regional Settings is in the sequence
ddmm instead of mmdd.
 
B

Brian W

Thanks, that worked!

Alice said:
I've been able to solve it. It seems the gadget is not intelligent enough
and it doesn't consider locales in the dd-mm-yyyy format. For a quick fix:

1. Go to the folder:
"C:\Users\<username>\AppData\Local\Microsoft\Windows
Sidebar\Gadgets\Uptime.gadget\en-US\core"

2. Make a backup copy of core.framework.vbs

3. Open core.framework.vbs in Notepad by rightclicking followed by Edit

4. Replace
Function WMIDateStringToDate(dtmBootup)

WMIDateStringToDate = CDate(Mid(dtmBootup, 5, 2) & "/" & _
Mid(dtmBootup, 7, 2) & "/" & Left(dtmBootup, 4) _
& " " & Mid (dtmBootup, 9, 2) & ":" & _
Mid(dtmBootup, 11, 2) & ":" & Mid(dtmBootup,13, 2))

End Function

by

Function WMIDateStringToDate(dtmBootup)

WMIDateStringToDate = CDate(Mid(dtmBootup, 7, 2) & "/" & _
Mid(dtmBootup, 5, 2) & "/" & Left(dtmBootup, 4) _
& " " & Mid (dtmBootup, 9, 2) & ":" & _
Mid(dtmBootup, 11, 2) & ":" & Mid(dtmBootup,13, 2))

End Function

5. Save core.framework.vbs

6. Open a new instance of Uptime from the gadget gallery.

7. Done


Note: the only thing that's different in step 4 between the two functions
is
5 and 7 being swapped. This corrects the dd-mm and mm-dd format.

The place where it goes wrong is in the line
dtmSystemUptimeSecs = DateDiff("s", dtmLastBootUpTime, Now)
because the Now format changes based on the locale settings. By changing
dtmLastBootupTime accordingly, the date difference remains correct.

This only works when your short date in Regional Settings is in the
sequence
ddmm instead of mmdd.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top