# Text To Date Calculating Incorrectly

**URL:** <https://community.glideapps.com/t/text-to-date-calculating-incorrectly/42874>\
**Category:** Ask for Help\
**Created:** [June 9, 2022, 10:21am UTC](https://community.glideapps.com/t/text-to-date-calculating-incorrectly/42874 "2022-06-09T10:21:11Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mwza](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mwza/32/43529_2.png) [@mwza](https://community.glideapps.com/u/mwza)\
**Post date:** [June 9, 2022, 10:21am UTC](https://community.glideapps.com/t/text-to-date-calculating-incorrectly/42874/1 "2022-06-09T10:21:11Z")

</div>

Hi All

I am asking registrants to capture an ID number and a birthdate as part of the data in a database. Since the first 6 digits of the ID number correspond to an individual’s birth date in the format yymmdd, I am trying to validate the two captures by comparing the values to test that they match.

I sliced out the first 6 digits of the ID number captured, used a template column to “build” a date made from the sliced components, and then use the Text to Date column to create a date against which i can compare the captured birth date value.

The result I am getting is that the day element in the Text to Date date is a day earlier than I would expect given the “sliced” dd value?

Appreciate any suggestions!

 ![CleanShot 2022-06-09 at 11.43.41](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/a/2/a25ad5411ebb5f513b28102f53cf9351f1c8a75b.png)

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [June 10, 2022, 12:06am UTC](https://community.glideapps.com/t/text-to-date-calculating-incorrectly/42874/2 "2022-06-10T00:06:21Z")

</div>

I think it might have something to do with timezones here. I seemed to have faced this problem a few times already, so I don’t use date plugins for use cases like this anymore.

I think you can take an alternative approach of converting them to a numeric value.

- ID number: Slice first 6 numbers. I’m not sure if this returns a text or a number. If it doesn’t work directly then maybe use a math column pointing to the slice result to convert it to a number.

- DOB in date form: Convert to numeric value by using a math column.

MOD(YEAR(D),100)\*10000 + MONTH(D)\*100 + DAY(D)

with D being the DOB.

Then compare the two values together to see if they match.

---

<div class="post-metadata">

**Author:** ![gvalero](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/gvalero/32/1037_2.png) [@gvalero](https://community.glideapps.com/u/gvalero)\
**Post date:** [June 10, 2022, 1:52am UTC](https://community.glideapps.com/t/text-to-date-calculating-incorrectly/42874/3 "2022-06-10T01:52:36Z")

</div>

Hola!

Try with another Date plugin and procedure, I have used this for something similar and works fine

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/6/b/6bafae7eaacc0abd106d25f7f0efd45d9e5c0f1e.png)

---

<div class="post-metadata">

**Author:** ![mwza](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mwza/32/43529_2.png) [@mwza](https://community.glideapps.com/u/mwza)\
**Post date:** [June 10, 2022, 5:45am UTC](https://community.glideapps.com/t/text-to-date-calculating-incorrectly/42874/4 "2022-06-10T05:45:13Z")

</div>

Thank you @ThinhDinh - this worked - I did have to convert the “sliced” text via a math column to handle values from years 2000 to 2009 where the sliced text includes leading zero’s, not compatible with a math test to compare with the converted DOB.

Thank you!

@gvalero thanks for suggestion - just to note my input data is a text string not a date hence the format plugin not valid in this use case.

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/system/32/53398_2.png) [@system](https://community.glideapps.com/u/system)\
**Post date:** [June 11, 2022, 5:46am UTC](https://community.glideapps.com/t/text-to-date-calculating-incorrectly/42874/5 "2022-06-11T05:46:07Z")

</div>

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.
