I interpret your question as asking how to convert a text date to a date value.
Well, there's CTOD() for that, but it's easiest if you bind a textbox to a field or property being a date or initialize the value (simply set the textbox.value in the designer in the property sheet) to a date.
For example right click on the textbox for date entry, select "Properties..." from the context menu and then in the Data Tab in the Value property enter =DATE() and the textbox is initialised to the current date.
Once a textbox displays and has a date value, you can only enter valid dates and textbox.value will be a date, no need to convert it.
CTOD could be relevant to transform data you get as text, it depends on settings of SET DATE, SET MARK TO (caution, there are other SET MARK commands about menu items) and SET CENTURY, there is no automatism to take any text that could resemble a date and convert it and since some formats are month first, others day first, there are ambiguous dates, so you have to first set the way you want dates to display and then you can also reverse texts in that format to dates.
The preferred way to specify dates in code, for example, that is independent of settings is either call DATE() or DATETIME(). Without parameters they provide the values of today and now, parameters allow you to specify a specific date, eg DATE(1999,12,31) but besides needing to call a function date literals are possible in the form {^yyyy-mm-dd}, so you can code datevar = {^1999-12-31}, this also works independant on what the current MARK setting is, even if you have other countries marks like / or . you can always use the dash here and just like DATE() the date literals only allow ymd order. Caution and notice: The string "{^1999-12-31}" doesn't automatically convert into a date, you really write curly brackets as delimiters in code and when you enter such a literal into a textbox that does not come out as such a date but such a string, you can EVAL("{^1999-12-31}"), though, to get that as the date it means.
Besides that, you can compute with dates, like DATE()-7: Date a week ago, DATEIME()+60: DateTime in a minute. GOMONTH(DATE(),1): Date in a month (look into the help topic about how 31 turns into 30 of next month, for example and other special cases).
Bye, Olaf.
Olaf Doschke Software Engineering