DIA DA SEMANA SEM WEEKDAY

USUARIO.EXCLUIDOS 05/07/2007 11:56:31
#224792
Bom dia


pesoal, preciso escrever um codigo para obter o dia da semana sem usar o weekday.

Sei que é possível obter por congruência mod7, mas não tenho a habilidade de escrever este código... alguém tem aí?


valeu,,,
USUARIO.EXCLUIDOS 05/07/2007 12:06:15
#224797

Na boa...pode explicar pq n é weekday?

USUARIO.EXCLUIDOS 05/07/2007 12:12:57
#224798
Porque o código será usado em um ambiente BASIC que não possui a função weekday. é para embed systens...
USUARIO.EXCLUIDOS 05/07/2007 12:32:53
#224809


Blz...seria bom..vc explicar melhor da próxima vez..para q possamos ajudá-lo melhor

té mais
WEBMASTER 05/07/2007 12:41:24
#224810
Resposta escolhida
Essa eh do fundo do bau, veja se esse codigo em BASIC te ajuda...


' WEEKDAY$(3.0)
' WEEKDAY$ function returns the name of the day of a week
'(abbreviated to three characters) for the specified date.
' DECLARE FUNCTION WEEKDAY$(Spec.Date$)
' Parameter
'----------------------------------------------------------------
' Spec.Date$ - Specified date in the form of MM-DD-YY
' or MM-DD-CCYY (should be a valid date
' in Gregorian calendar)
--------------------------------------------------------------------
' Examples
' WEEKDAY$("" )="Fri" - Today 03-08-2002
' WEEKDAY$("*1-01-1996")="***"
' WEEKDAY$("12-31-1996")="Tue"
' WEEKDAY$("01-01-1997")="Wed"
' WEEKDAY$("12-31-1997")="Wed"
' WEEKDAY$("01-01-1998")="Thu"
' WEEKDAY$("12-31-1998")="Thu"
' WEEKDAY$("12-31-04" )="Fri"

DECLARE FUNCTION VALDGRE%(Spec.Date$)
DefInt A-Z ' All defaulted variables are integer
[c] FUNCTION WEEKDAY$(Spec.Date$) PUBLIC

If (Len(Spec.Date$) = 0) Then
DT$ = Date$
ElseIf (VALDGRE%(Spec.Date$)) Then
DT$ = Spec.Date$
Else
WEEKDAY$ = "***"
Exit Function
End If

Month = Val(Left$(DT$, 2))
Day = Val(Mid$(DT$, 4, 2))

If (Len(DT$) = 8) Then
Year = Val(Mid$(Date$, 7, 2) + Right$(DT$, 2))
Else
Year = Val(Right$(DT$, 4))
End If

If (Month < 3) Then
Month = Month + 12
Year = Year - 1
End If

Day.Index = (Day + Int((13 * Month - 27) / 5) + Year + Int(Year / 4) - Int(Year / 100) + Int(Year / 400)) Mod 7

WEEKDAY$ = Mid$("SunMonTueWedThuFriSat", 3 * Day.Index + 1, 3)
End Function

[/c]
USUARIO.EXCLUIDOS 05/07/2007 14:29:49
#224837
Nota 11 webmaster. Esta dos velhos tempos matou a pau! obrigado mesmo
Tópico encerrado , respostas não são mais permitidas