# Date format for dd/MM/yyyy?

**URL:** <https://forums.eggplantsoftware.com/t/date-format-for-dd-mm-yyyy/8045>\
**Category:** Eggplant Functional\
**Tags:** script, sensetalk, eggplant-functional\
**Created:** [October 6, 2022, 12:58pm UTC](https://forums.eggplantsoftware.com/t/date-format-for-dd-mm-yyyy/8045 "2022-10-06T12:58:25Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Paul](https://forums.eggplantsoftware.com/letter_avatar_proxy/v4/letter/p/bbe5ce/32.png) [@Paul](https://forums.eggplantsoftware.com/u/Paul)\
**Post date:** [October 6, 2022, 12:58pm UTC](https://forums.eggplantsoftware.com/t/date-format-for-dd-mm-yyyy/8045/1 "2022-10-06T12:58:25Z")

</div>

Hi

Is there an in-built function that returns the date in the format of “dd/MM/yyyy”? I can see just about every other variation and most assume 2-digit year, which is a bit 1990s 🙂

the closest I could find was:

```auto
formattedTime(the timeFormat's shortdate, now)

```

alternatively if there is a setting like

```auto
set clockformat to "24"

```

that will force the year interpretation to 4-digit year?

thanks

---

<div class="post-metadata">

**Author:** ![DaveHester](https://forums.eggplantsoftware.com/user_avatar/forums.eggplantsoftware.com/davehester/32/104_2.png) [@DaveHester](https://forums.eggplantsoftware.com/u/DaveHester)\
**Post date:** [October 6, 2022, 1:39pm UTC](https://forums.eggplantsoftware.com/t/date-format-for-dd-mm-yyyy/8045/2 "2022-10-06T13:39:06Z")

</div>

If you want to use this for any date, here is the format:

```auto
set myDate to today
log formattedTime("%m",myDate) &"/"& formattedTime("%d",myDate) &"/"& formattedTime("%Y",myDate)

```

If you want to use it for the current date, you can simplify it to this:  
`log formattedTime("%m",Date) &"/"& formattedTime("%d",Date) &"/"& formattedTime("%Y",Date)`

---

<div class="post-metadata">

**Author:** ![Paul](https://forums.eggplantsoftware.com/letter_avatar_proxy/v4/letter/p/bbe5ce/32.png) [@Paul](https://forums.eggplantsoftware.com/u/Paul)\
**Post date:** [October 7, 2022, 2:14pm UTC](https://forums.eggplantsoftware.com/t/date-format-for-dd-mm-yyyy/8045/3 "2022-10-07T14:14:05Z")

</div>

Hi Dave

Thanks for the reply. Before i saw your reply i had a rare moment of clarity and used the following to generate “tmorrows” date, in UK date format:

```auto
formattedTime("%d/%m/%Y", now + one day)

```

Would you foresee any issues with this compressed approach?

thanks

---

<div class="post-metadata">

**Author:** ![DaveHester](https://forums.eggplantsoftware.com/user_avatar/forums.eggplantsoftware.com/davehester/32/104_2.png) [@DaveHester](https://forums.eggplantsoftware.com/u/DaveHester)\
**Post date:** [October 10, 2022, 5:28pm UTC](https://forums.eggplantsoftware.com/t/date-format-for-dd-mm-yyyy/8045/4 "2022-10-10T17:28:08Z")

</div>

Not at all. I think that the code I included must have come from a time before when the compressed version was not available.

---

<div class="post-metadata">

**Author:** ![SenseTalkDoug](https://forums.eggplantsoftware.com/user_avatar/forums.eggplantsoftware.com/sensetalkdoug/32/88_2.png) [@SenseTalkDoug](https://forums.eggplantsoftware.com/u/SenseTalkDoug)\
**Post date:** [November 15, 2022, 6:13pm UTC](https://forums.eggplantsoftware.com/t/date-format-for-dd-mm-yyyy/8045/5 "2022-11-15T18:13:11Z")

</div>

Speaking of outdated formats like 2-digit years, the formatting codes using “%” are very old-school now! Take a look at the documentation on [date and time formats](https://docs.eggplantsoftware.com/studio/stk-date-formats/) and use the bracket formats instead:  
`put formattedTime("[day]/[month]/[year]", tomorrow)`

or, for 2-digit day and month:  
`put formattedTime("[da]/[mo]/[year]", tomorrow)`

And (this may not be well documented – I’ll try to correct that soon) you can also do it this way:  
`put tomorrow with format "[day]/[month]/[year]"`
