Frank Schönheit - Sun Microsystems Germany wrote:
Ripped the following from another document
(and cannot remotely judge
how complete it is, but it looks complicated enough ;)
Aye, there lay the rub! Looking at the code it appears to be
implementing the ISO standard and I suppose that is a good thing.
, perhaps it helps:
' Calculate the current week of the year (usually 1 .. 52)
Function getWeekOfYear() As Integer
Dim d As Date
Dim t As Date
d = Date()
t = DateSerial(_
Year(DateValue(d) + (8 - Weekday(d)) Mod 7 - 3), 1, 1)
getWeekOfYear = (_
DateValue(d) - t - 3 + (Weekday(t) + 1) Mod 7) \ 7 + 1
End Function
Speaking of rubs...Dates aint Dates all the time in OO.o, so you have to watch
which one you use
ResultSet.Column(x).getDate = a com.sun.star.util.Date structure
DateControl.getDate = a date encoded into an long, that is intended to be
converted to a string or so it seems
DateControl.Model.CurrentValue = a com.sun.star.util.Date structure
Date() = a long
DateControl.getText = a string representing your date in either short or
long format and dependant on your OS's local time format settings I believe
Anyway, Dejik you can substitute this function for the the one in the
library - ( the parameter for the connection object is no longer needed,
but I left it here so you can just copy and paste this into the library
and not need to change the calling line )
function getWeek( aConn as variant, aDate as new "com.sun.star.util.Date" ) as
integer
Dim d As Date
Dim t As Date
d = DateSerial( aDate.Year, aDate.Month, aDate.Day )
t = DateSerial(_
Year(DateValue(d) + (8 - Weekday(d)) Mod 7 - 3), 1, 1)
getWeek = (_
DateValue(d) - t - 3 + (Weekday(t) + 1) Mod 7) \ 7 + 1
End Function
As for changing the logic of when it is called, I can do that for you if
you like.
Drew
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]