Suppose a form allows the input of the month and year only. You want to store this as the first day of that month. First create a literal date string from the month and year numbers, then use CTOD( ) to convert that string into a date, as follows:

function saveButton_onClick

local cDate 

cDate = "" + form.month.value + "/01/" + form.year.value // Create string 

form.rowset.fields[ "Start date" ].value = ctod( cDate ) // Store in date field 

form.rowset.save() 

This function assumes that the current SET DATE format is MDY, or something similar, like AMERICAN.