devxlogo

Do You Know About Date Literals?

Do You Know About Date Literals?

Using a Date literal is about 12 times faster-according to NuMega TrueTime-than using the CDate function and converting a string literal. Here’s an example:

 Dim TestDate as Date	'The following 2 lines produce the same results	TestDate = #7/1/98#	TestDate = CDate("7/1/98")

Just as you enclose a string literal with quotes (“Hello”), you can enclose Date literals with pound signs (#07/07/1998#). So, these are all valid Date literals: #July 7, 1998#, #7-JUL-98#, and #07/07/1998#

devx-admin

Share the Post: