Any idea why this won’t work?
Dim str_date As String, str_date2 As String
str_date = "06/30/2008 12:00:00 AM"
str_date2 = Format$(str_date2, "dd-mmm-yyyy")
I expected the second string to be set to “30-Jun-2008”, but instead, it’s set to the first string’s value: “06/30/2008 12:00:00 AM”. In other words, Format$ does nothing. Am I doing something wrong here?
Subject: Date format problem
Sam, you can use the Format$ function to format date values in the way you’re trying to, but not string values. If you carefully read the Domino Designer Help for the Format[$] function you’ll understand what I mean. I think what you’re trying to do can be accomplished like this (I placed this code in an action button and tested):
Dim var_date As Variant, str_date2 As String
' Datevalue is a LotusScript function for converting date strings to LotusScript date values.
var_date = Datevalue("06/30/2008 12:00:00 AM")
str_date2 = Format$(var_date, "dd-mmm-yyyy")
Msgbox str_date2 ' Displays "30-Jun-2008"
Subject: Date format problem
A date is not a String. If you want to work with a date, use a Variant. Do not use a String. Format$ converts a date into a String, but it is a bad idea to do anything much with the String, except display it.