Simon, there is a standard Enumeration called "DayOfWeek" which should be
used if possible. In this enumeration, Sunday=0 and Saturday=6. If you want
to use different values, then maybe you should create your own Enumeration
like:
Public Enum MyDaysOfTheWeek
Saturday = 0
Sunday = 1
Monday = 2
etc. etc.
End Enum
You could then use the [Enum].Parse method to turn the String "Monday" into
the value 2. E.g.
myDayOfWeekValue = CType([Enum].Parse(GetType(DaysOfWeek), "Monday"),
DayOfWeek)
I don't recommend using your own enumeration because it will be incompatible
with the DateTime.DayOfWeek() function (which returns what day of the week
the date variable is)
If I have date="13.12.2003" and hour=9 and second =20 what is the best way
to get datetime value?
To turn that date into a proper date time variable, use the following:
Dim myDate as New Date(2003, 12, 13, 9, 0, 20)
The date structure can take many different arguments as its constructor. In
the example above they are Year, Month, Day, Hour, Minute, Second.
Incedentally, the following will return Saturday (which is equal to 6)
Dim myDate as New Date(2003, 12, 13, 9, 0, 20)
debug.WriteLine(myDate.DayOfWeek)
debug.WriteLine(cint(myDate.DayOfWeek))
Hope this helps,
Trev.