Visual Basic - Problema con WeekDay en win vista

Life is soft - evento anual de software empresarial
 
Vista:

Problema con WeekDay en win vista

Publicado por Gil Rivera (2 intervenciones) el 25/11/2009 19:15:25
Realizo una consulta en VB usando ADO que utiliza WeekDay en win xp funciona sin problemas, pero en win vista me genera resultados diferentes, como que no coinciden los datos de WeekDay, sabe alguien que pasa y como solucionarlo por favor, gracias
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
sin imagen de perfil
Val: 119
Ha disminuido 1 puesto en Visual Basic (en relación al último mes)
Gráfica de Visual Basic

RE:Problema con WeekDay en win vista

Publicado por Christian (713 intervenciones) el 28/11/2009 00:30:30
Mira lo que tengo entendido que al principio vb6 y vista no eran compatibles, despues lo mejoraron y solo fallaba en las primeras versiones de vista. Conclusion que todo quedo inconcluso.

Solucion? hacerte tu propia funcion weekday. mira te enconte un ejemplo

Public Function DOW(ByVal GregDate As Date) As String
' Return values:
' 0 = Sunday
' 1 = Monday
' 2 = Tuesday
' 3 = Wednesday
' 4 = Thursday
' 5 = Friday
' 6 = Saturday
Dim y As Integer
Dim m As Integer
Dim d As Integer

' monthdays:
' This is a "template" for a year. Each number
' stands for a day of the week. The general idea
' is that, in a standard year, if Jan 1 is on a
' Friday, then Feb 1 will be a Monday, Mar 1
' will be a Monday, April 1 will be a Thursday,
' May 1 will be Saturday, etc..
Dim mcode As String
Dim monthdays() As String
monthdays = Split("5 1 1 4 6 2 4 0 3 5 1 3")

' Grab our date info
y = Val(Format(GregDate, "yyyy"))
m = Val(Format(GregDate, "mm"))
d = Val(Format(GregDate, "dd"))

' Snatch the corresponding month code
mcode = Val(monthdays(m - 1))

' Multiplying by 1.25 takes care of leap years,
' but not completely. Jan and Feb of a leap year
' will end up a day extra.
' The 'mod 7' gives us our day.
DOW = ((Int(y * 1.25) + mcode + d) Mod 7)

' This takes care of leap year Jan and Feb days.
If y Mod 4 = 0 And m < 3 Then DOW = (DOW + 6) Mod 7
End Function

suerte amigo.-
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar