Form - Cleaning Date Time data
1 Overview
Date and time formats vary wildly. American and European dates can become easily confused when used in Excel or other tools which think they're being used on a different continent.
Throughout bxp date time fields use Universal Date Time format. This means YYYY-MM-DD HH:mm:SS
- Y : Year
- M : Month
- D : Day
- H : Hour
- m : minute
- S : Second
Universal Date Time format has a number of distinct advantages.
- It's unambiguous.
- When ordered by a database and the contents are a string (as opposed to a date time field), they will order correctly
To explain this last point. You have two dates 29/01/2017, which is the 29th of January 2017. You also have the 01/09/2017, the 1st of September 2017. In an ordered list you would expect this to be
- 29/01/2017
- 01/09/2017
Unfortunately by default when this data is text, 0 is < 2 so the list actually outputs as
- 01/09/2017
- 29/01/2017
With UDT, even if the data is text and not a date time field, it will always sort correctly.
- 2017-01-29
- 2017-09-01
2 Cleaning data
When you upload data into bxp from an Excel spreadsheet or even injected from an external website or app, the data can come in, in European or American format. To save time, bxp has a mass date time correction function.
Main Menu > Form - Management > Form - Data Cleaning > Mass Update - Convert data to UDTF
- Format : European or America, see outputs below for comparisons
- Source : Field holding the data to be converted
- Destination : Field into which the converted data will be stored
- Custom Where : If a custom grouping of fields is required
- Add Time : Should the time part of the data be included? if no time available 00:00:00 added.
3 Outputs
This table of sample data is provided as an example of how the system will handle your data. European format with no dates.
Sample Raw Data | European Conversion | American Conversion |
---|---|---|
01/01/17 | 2017-01-01 | 2017-01-01 |
01/01/2017 | 2017-01-01 | 2017-01-01 |
1/1/17 | 2017-01-01 | 2017-01-01 |
1/1/2017 | 2017-01-01 | 2017-01-01 |
1/Jan/17 | 2017-01-01 | 2017-01-01 |
1/Jan/2017 | 2017-01-01 | 2017-01-01 |
1 Jan 17 | 2017-01-01 | 2017-01-01 |
1 Jan 2017 | 2017-01-01 | 2017-01-01 |
1 January 17 | 2017-01-01 | 2017-01-01 |
1 January 2017 | 2017-01-01 | 2017-01-01 |
1st January 17 | 2017-01-01 | 2017-01-01 |
1st January 2017 | 2017-01-01 | 2017-01-01 |
2017-1-1 | 2017-01-01 | 2017-01-01 |
2017-01-01 | 2017-01-01 | 2017-01-01 |
Ambiguous | ||
10/9/2017 | 2017-09-10 | 2017-10-09 |
9/10/2017 | 2017-10-09 | 2017-09-10 |
Wrong for testing | ||
13/1/2017 | 2017-01-13 | 2017-01-13 |
1/13/2017 | 2017-01-13 | 2017-01-13 |
02/31/2017 | Nothing | Nothing |
31/02/2017 | Nothing | Nothing |
2017-02-31 | Nothing | Nothing |