DIA DA SEMANA SEM WEEKDAY
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,,,
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,,,
Na boa...pode explicar pq n é weekday?
Porque o código será usado em um ambiente BASIC que não possui a função weekday. é para embed systens...
Blz...seria bom..vc explicar melhor da próxima vez..para q possamos ajudá-lo melhor
té mais
Essa eh do fundo do bau, veja se esse codigo em BASIC te ajuda...
[/c]
' 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]
Nota 11 webmaster. Esta dos velhos tempos matou a pau! obrigado mesmo
Tópico encerrado , respostas não são mais permitidas