Convert date formats in EDC/CDMS
Table of Contents
Study admins can define a custom date format for each institute in the Settings tab.
Alternatively, it is possible use calculations to change this format by getting the day (dd), month (mm), and year (yyyy). In this article examples are shown that you can use in your calculation templates. We'll use the date 30 January 2025 as an example throughout the article.
ddmmyyyy
For example, if you enter the value 30-01-2025 (30 January 2025) in a date field, this calculation template will convert that to 30012025. Test the calculation template in the calculation tool here.
var date = "{your_date_variable}";
var day = date.substr(0,2);
var month = date.substr(3,2);
var year = date.substr(6,4);
day + "" + month + "" + year;
mm/dd/yyyy
For example, if you enter the value 30-01-2025 (30 January 2025) in a date field, this calculation template will convert that to 01/30/2025. Test the calculation template in the calculation tool here.
var date = "{your_date_variable}";
var day = date.substr(0,2);
var month = date.substr(3,2);
var year = date.substr(6,4);
month + "/" + day + "/" + year;