Not all desktops have this error, even they have the same regional setting for date.
The code even fail on this code:
dim myyear as integer
myyear = weekday ("05/14/2008")
I solved this by setting two digits for year in date format setting in “regional and language setting” in control panel.
What is wrong?
Thanks!
Subject: Error: Type Mismatch in calling function weekday()
convert the string to a date using one of the date type functions
CDAT, etc.
Subject: Error: Type Mismatch in calling function weekday()
OK, I won’t wask why you call your variable myyear and yet you’re getting the day of the week.
The fact it’s “working” when you say it’s a 2 digit year still sounds like a regional setting issue to me (it’s taking 08 and thinking it’s a Month or Day). Try changing the date to “05/14/2038” and I think you’ll find even your 2 digit work around will give you a type mismatch again.
I would code it as follows:
dim myyear as integer
myyear = weekday ( date(2008, 5, 14) )
If you need to work with a string in a paricular format then do:
dim myyear as integer
yr = Right(stringvar, 4)
mn = Left( stringvar, 2)
dy = Mid( strignvar, 3,2) ’ Check this - as I always seem to be off by 1
myyear = weekday ( date(yr, mn, dy) )
Subject: RE: Error: Type Mismatch in calling function weekday()
The example in my previous post is just tried to simplify the real scenario.
Actually the date string comes from:
ndtComplDate.DateOnly
ndtComplDate is a NotesDateTime object. Since its return will be in various formats in different desktops, so I cannot parse the string to get year, month and day.
So un-predicted date format in ndtComplDate.DateOnly will cause: weekday ( ndtComplDate.DateOnly ) produce type mismatch error.?
What is the correct way to get year/month/day information from a NotesDateTime object?
Many thanks!
Subject: RE: Error: Type Mismatch in calling function weekday()
Try that, the format command will enter a consistent pattern.
weekday ( Format(ndtComplDate), “yyyy/mm/dd”) )
Subject: Thanks, problem solved.
Thanks! This one works!
If Weekday ( Format( ndtComplDate.DateOnly, “yyyy-mm-dd”) ) <> 1 then
…
…
Subject: RE: Error: Type Mismatch in calling function weekday()
It works? I still get Type Mismatch error.