"Error 13 Type Mismatch error" in Domino 6 while using CDAT

Hi All,

One of my code is using CDAT function in server side scripting. Suddenly I find , the script is getting stuck at CDAT .

To confirm it , i wrote a very simple script that does conversion. It ran on client flawlessly ,however, failed to run on server with “Type Mismatch” error.

Any pointer?

Any substitute to CDAT function and similar data conversion I need to consider in coding.

Sub Initialize

On Error Goto errorPara

Dim aVarDat As Variant

aVarDat = Cdat("10-10-2004")

Exit Sub

errorPara:

Print	"Error" & Err &  Error$ & | at line | & Cstr (Erl)	

End Sub

Subject: “Error 13 Type Mismatch error” in Domino 6 while using CDAT

I suspect the server has international settings such that 10-10-2004 is not a valid date format for it.

If you are unsure of the server settings a safer option would be to split the date in to numeric components and use:

DateNumber ( year , month , day )

HTH - Rufus.

Subject: RE: “Error 13 Type Mismatch error” in Domino 6 while using CDAT

datenumber(yyyy,dd,mm) worked!!

Conclusion- CDat is a bad option for data type conversion.

Thanks a TON for your post

HTH

Neelam

Subject: RE: “Error 13 Type Mismatch error” in Domino 6 while using CDAT

Not really. Cdat() is the best option when the same bit of code generates date strings (which is often unavoidable). If you generate a string from a date using Format and one of the system formatting strings (like “General Date” or “Long Date”), then Cdat will create the date properly at the other end.

This can make a lot of sense if you want to use a date as a List tag. The key is that you must do both conversions on the same machine at around the same time to make sure that settings aren’t changed, and that your conversion to text needs to be done using system settings (a named format).