# Date Set Not allowing Date property as mm/dd/yyyy

**URL:** <https://forums.pega.com/t/date-set-not-allowing-date-property-as-mm-dd-yyyy/7559>\
**Category:** General\
**Tags:** 8-8-4, data-management\
**Created:** [June 25, 2024, 10:08am UTC](https://forums.pega.com/t/date-set-not-allowing-date-property-as-mm-dd-yyyy/7559 "2024-06-25T10:08:07Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![Priyesh](https://avatars.discourse-cdn.com/v4/letter/p/4491bb/32.png) [@Priyesh](https://forums.pega.com/u/Priyesh)\
**Post date:** [June 25, 2024, 10:08am UTC](https://forums.pega.com/t/date-set-not-allowing-date-property-as-mm-dd-yyyy/7559/1 "2024-06-25T10:08:07Z")

</div>

We are looking to set a Date property as mm/dd/yyyywhile mapping from a file data set.

Data Flow Source is File Data Set:

CSV File has a column with “mm/dd/yyyy” format value ex: 5/14/2024.

In the Mapping Tab, a Date Property (Type: date) mapped to the excel column.

Getting Error while running the data flow. Bad Mapping Error.

Requirement is to store column value in this date property and save back to the DB table in a date type DB column.

Any suggestions would be helpful!

---

<div class="post-metadata">

**Author:** ![RameshSangili](https://yyz2.discourse-cdn.com/pega/user_avatar/forums.pega.com/rameshsangili/32/23377_2.png) [@RameshSangili](https://forums.pega.com/u/RameshSangili)\
**Post date:** [June 25, 2024, 2:17pm UTC](https://forums.pega.com/t/date-set-not-allowing-date-property-as-mm-dd-yyyy/7559/2 "2024-06-25T14:17:19Z")

</div>

@Priyesh

Please use

@DateTime.FormatDateTime(@DateTime.CurrentDateTime(),“ **MM/dd/YYYY** ’T’HH:mm:ss”, pxRequestor.pyDefaultTimeZone, “”)

---

<div class="post-metadata">

**Author:** ![Priyesh](https://avatars.discourse-cdn.com/v4/letter/p/4491bb/32.png) [@Priyesh](https://forums.pega.com/u/Priyesh)\
**Post date:** [June 25, 2024, 2:42pm UTC](https://forums.pega.com/t/date-set-not-allowing-date-property-as-mm-dd-yyyy/7559/3 "2024-06-25T14:42:30Z")

</div>

@RameshSangiliThanks for the response.

Where can we apply this function?

In the file dataset mapping tab, we are referring a Date type property and the excel file has value as ‘mm/dd/yyyy’.

We are trying to store in this property and save back to the DB table in a date type column.

Thanks!  
Priyesh A

---

<div class="post-metadata">

**Author:** ![RameshSangili](https://yyz2.discourse-cdn.com/pega/user_avatar/forums.pega.com/rameshsangili/32/23377_2.png) [@RameshSangili](https://forums.pega.com/u/RameshSangili)\
**Post date:** [June 25, 2024, 3:30pm UTC](https://forums.pega.com/t/date-set-not-allowing-date-property-as-mm-dd-yyyy/7559/4 "2024-06-25T15:30:38Z")

</div>

@Priyesh

I think you can add a data transform to massage the data based on your requirements.

---

<div class="post-metadata">

**Author:** ![Kishore\_Kumar\_Madduri](https://yyz2.discourse-cdn.com/pega/user_avatar/forums.pega.com/kishore_kumar_madduri/32/12808_2.png) [@Kishore\_Kumar\_Madduri](https://forums.pega.com/u/Kishore_Kumar_Madduri)\
**Post date:** [June 25, 2024, 7:08pm UTC](https://forums.pega.com/t/date-set-not-allowing-date-property-as-mm-dd-yyyy/7559/5 "2024-06-25T19:08:44Z")

</div>

@Priyesh:

In Dataset rule, below you will find Date time Format and Date format and Time Of Day format fields.Check whether the format in Date format field same as CSV file date column format.

For CSV and JSON files, update date and time settings:

1. In the Date Time format field, enter the pattern representing date and time stamps in the selected file.  
The default pattern is: _yyyy_-_MM_-_dd\*\*HH_:_mm_:_ss_

2. In the Date format field, enter the pattern representing date stamps in the selected file.  
The default pattern is: _yyyy_-_MM_-_dd_

3. In the Time Of Day format field, enter the pattern representing time stamps in the selected file.  
The default pattern is: _HH_:_mm_:_ss_

---

<div class="post-metadata">

**Author:** ![Priyesh](https://avatars.discourse-cdn.com/v4/letter/p/4491bb/32.png) [@Priyesh](https://forums.pega.com/u/Priyesh)\
**Post date:** [June 26, 2024, 11:34am UTC](https://forums.pega.com/t/date-set-not-allowing-date-property-as-mm-dd-yyyy/7559/6 "2024-06-26T11:34:48Z")

</div>

@KishoreKumarM2533 This seems to be working.

The value (06/24/2024) got saved to a date property as ‘20240624’ but not getting saved to DB Column of date type.

getting below error:

com.pega.pegarules.pub.database.BadTableMappingException:

table abc has an unknown type: JDBC Type: Date

any idea on this? Thanks!

---

<div class="post-metadata">

**Author:** ![MahavishnuN04](https://avatars.discourse-cdn.com/v4/letter/m/7ba0ec/32.png) [@MahavishnuN04](https://forums.pega.com/u/MahavishnuN04)\
**Post date:** [June 26, 2024, 11:54am UTC](https://forums.pega.com/t/date-set-not-allowing-date-property-as-mm-dd-yyyy/7559/7 "2024-06-26T11:54:17Z")

</div>

Hi @Priyesh

In your Data Flow, ensure that the Date Format specified for the CSV file matches the actual format of the date column.  
You can find this setting in the Data Set configuration.  
If your CSV file has dates in “mm/dd/yyyy” format, set the Date Format accordingly.

Create a data transform to convert the CSV date value to the desired format for your Date property.  
Use the @DateTime.FormatDateTime function to transform the date value.

**@DateTime.FormatDateTime(@DateTime.CurrentDateTime(), “MM/dd/yyyy”, pxRequestor.pyDefaultTimeZone)**  
This function converts the current date to the “mm/dd/yyyy” format.

In the Mapping Tab, ensure that the Date Property is correctly mapped to the transformed date value.

---

<div class="post-metadata">

**Author:** ![RameshSangili](https://yyz2.discourse-cdn.com/pega/user_avatar/forums.pega.com/rameshsangili/32/23377_2.png) [@RameshSangili](https://forums.pega.com/u/RameshSangili)\
**Post date:** [June 26, 2024, 1:42pm UTC](https://forums.pega.com/t/date-set-not-allowing-date-property-as-mm-dd-yyyy/7559/8 "2024-06-26T13:42:39Z")

</div>

@Priyesh

You’re using OOTB FormatDateTime function to covert the date to your required format.

---

<div class="post-metadata">

**Author:** ![Priyesh](https://avatars.discourse-cdn.com/v4/letter/p/4491bb/32.png) [@Priyesh](https://forums.pega.com/u/Priyesh)\
**Post date:** [June 26, 2024, 12:24pm UTC](https://forums.pega.com/t/date-set-not-allowing-date-property-as-mm-dd-yyyy/7559/9 "2024-06-26T12:24:27Z")

</div>

@MahavishnuN04

Thanks!

Post selecting the format in Data set setting, date property is holding value (in yyyymmdd), but not getting saved to the db column.

DB column is of date type.

Error:

com.pega.pegarules.pub.database.BadTableMappingException:

table abc has an unknown type: JDBC Type: Date

Thanks!  
Priyesh A

---

<div class="post-metadata">

**Author:** ![Kishore\_Kumar\_Madduri](https://yyz2.discourse-cdn.com/pega/user_avatar/forums.pega.com/kishore_kumar_madduri/32/12808_2.png) [@Kishore\_Kumar\_Madduri](https://forums.pega.com/u/Kishore_Kumar_Madduri)\
**Post date:** [June 26, 2024, 1:44pm UTC](https://forums.pega.com/t/date-set-not-allowing-date-property-as-mm-dd-yyyy/7559/10 "2024-06-26T13:44:58Z")

</div>

@Priyesh Can you check the db column data type properly.

please refer this, would be helpful: [Having BadTableMappingException after updating to 7.2.2 | Support Center](https://support.pega.com/question/having-badtablemappingexception-after-updating-722)

---

<div class="post-metadata">

**Author:** ![Priyesh](https://avatars.discourse-cdn.com/v4/letter/p/4491bb/32.png) [@Priyesh](https://forums.pega.com/u/Priyesh)\
**Post date:** [June 26, 2024, 2:44pm UTC](https://forums.pega.com/t/date-set-not-allowing-date-property-as-mm-dd-yyyy/7559/11 "2024-06-26T14:44:47Z")

</div>

@KishoreKumarM2533

The Column was created as ‘Date(13)’ not sure if that’s correct or not, but that’s what it was created by DBA at backend.

The article mentioned above seems to be for MessageTimeStamp, where we have date as column type.

Thanks!

Priyesh A

---

<div class="post-metadata">

**Author:** ![MahavishnuN04](https://avatars.discourse-cdn.com/v4/letter/m/7ba0ec/32.png) [@MahavishnuN04](https://forums.pega.com/u/MahavishnuN04)\
**Post date:** [June 27, 2024, 6:17am UTC](https://forums.pega.com/t/date-set-not-allowing-date-property-as-mm-dd-yyyy/7559/12 "2024-06-27T06:17:58Z")

</div>

Hi @Priyesh

Verify that the database columns have the correct data types. Pega may not support certain column types.

If you encounter issues with date-related columns, consider altering the column type to `TIMESTAMP`.

For dates, Pega typically uses data types like `DateTime`, `Date`, or `Time`. Ensure that the Pega property corresponds correctly to the database column type.

Sometimes, JDBC drivers might not fully support certain data types or their mappings. Ensure that you are using a JDBC driver version that is compatible with the data types in your database. Updating or changing the JDBC driver version might resolve compatibility issues.

---

<div class="post-metadata">

**Author:** ![Priyesh](https://avatars.discourse-cdn.com/v4/letter/p/4491bb/32.png) [@Priyesh](https://forums.pega.com/u/Priyesh)\
**Post date:** [June 27, 2024, 10:48am UTC](https://forums.pega.com/t/date-set-not-allowing-date-property-as-mm-dd-yyyy/7559/13 "2024-06-27T10:48:35Z")

</div>

@MahavishnuN04

As per the below doc,

[Pegasystems Documentation](https://docs-previous.pega.com/user-experience/87/date-properties?#:~:text=You%20can%20enter%20a%20date,can%20have%20a%20null%20value).

For PostgresSQL, date property in pega can only support DB column as varchar(8)

and even if we want to use Date column as ‘Date’, we need to pass as yyyy-MM-dd, where as Date property in pega supports or holds yyyyMMdd.

I tried saving a text property value as yyyy-MM-dd value to a ‘Date’ property but it is not changing (keeping as yyyymmdd only). Also tried datetimeformat function but no help.

Thanks!

Priyesh A

---

<div class="post-metadata">

**Author:** ![Priyesh](https://avatars.discourse-cdn.com/v4/letter/p/4491bb/32.png) [@Priyesh](https://forums.pega.com/u/Priyesh)\
**Post date:** [June 26, 2024, 11:30am UTC](https://forums.pega.com/t/date-set-not-allowing-date-property-as-mm-dd-yyyy/7559/14 "2024-06-26T11:30:39Z")

</div>

@RameshSangiliThis worked but was looking for a OOTB Solution, without any mapping.
