ATTENTION: THIS IS OUR OLD SITE. TO SEE OUR NEW WEBSITE, CLICK HERE.
This code example shows how to format a date to DD/MM/YYYY for both individual and repeater display.
The following code formats a date of birth field to DD/MM/YYYY and displays it through a text field called txtBirthday. The formatting code is in the function formatFields(), which is called once the page and dbPeople dataset is ready. It checks if a date of birth is populated and hides the txtBirthday field if not. If the date of birth field is populated, then it formats the field as DD/MM/YYYY.
The following code formats the create date of news articles to DD/MM/YYYY for display on a repeater. The date format code is again housed in a function called formatFields(), which is called once the page and the dbArticles dataset is ready - and then still only after a short 200 millisecond delay. Within the formatFields() function, the formatting is done after the dbArticle items are individually ready. Finally, the formatted date is displayed on a text field called txtDate on the repeater.