I support the design template for a database that is used globally. Groups download the template and apply it to their own instance of the database.
Since this is used gloabally I need to give the DBA the option to select the date format to use throughout the database for consistancy.
In the database Profile Document I give them a radio button field to select the format they want (ie. mm/dd/yyyy, dd/mm/yyyy or yyyy/mm/dd)
My code gets the format from the Profile Document.
In Options: Use “DBDateFormat”
'---------------------------------------------
'set dates to the Profile Document format selected
Dim db_dateformat As String
Dim db_dateonly As String
Dim db_datetime As String
Dim db_dt As Variant
Dim db_dteonly As Variant
db_dateonly = DBDateFormat( db_dateformat )
db_datetime = db_dateonly+" hh:mm:ss"
db_dt = Format(Now, db_datetime)
db_dteonly = Format(Now, db_dateonly)
'--------------------------------------------
This works fine for date/time stamping text strings (logging info and such) But when I try to apply the selected format to a field of Date/Time datatype, it converts it to Text datatype.
I’ve tried:
Set tmptime=New NotesDateTime(db_dteonly)
but it still ends up as a Text datatype.
The date/time fields have to be “Date/Time” datatype because they’re used to control the execution of revalidation and QEVs and have to be used with Adjust methods:
Call RemindDate.AdjustDay( 7 )
How can I apply the date format selected in the Profile Document to date fields of Date/Time datatype and retain the Date/Time datatype?
Your help will be greatly appreciated. Thank You