# What is the best date datatype to use in a web app when

**URL:** <https://forum.xojo.com/t/what-is-the-best-date-datatype-to-use-in-a-web-app-when/86795>\
**Category:** Databases\
**Created:** [October 22, 2025, 11:49pm UTC](https://forum.xojo.com/t/what-is-the-best-date-datatype-to-use-in-a-web-app-when/86795 "2025-10-22T23:49:56Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tim\_Seyfarth](https://forum.xojo.com/letter_avatar_proxy/v4/letter/t/d26b3c/32.png) [@Tim\_Seyfarth](https://forum.xojo.com/u/Tim_Seyfarth)\
**Post date:** [October 22, 2025, 11:49pm UTC](https://forum.xojo.com/t/what-is-the-best-date-datatype-to-use-in-a-web-app-when/86795/1 "2025-10-22T23:49:56Z")

</div>

Hello all,

What is the best date datatype to use when developing a cloud based app?

In my case, the server is in a different country than the users so time zones come into play. What is the best way to plan for this? What changes in code are necessary?

Any other helpful info available?

Thanks  
Tim

---

<div class="post-metadata">

**Author:** ![Greg\_O](https://forum.xojo.com/user_avatar/forum.xojo.com/greg_o/32/22785_2.png) [@Greg\_O](https://forum.xojo.com/u/Greg_O)\
**Post date:** [October 23, 2025, 1:54am UTC](https://forum.xojo.com/t/what-is-the-best-date-datatype-to-use-in-a-web-app-when/86795/2 "2025-10-23T01:54:41Z")

</div>

If you’re using Xojo 2020 or higher, you should be using DateTime. Session has a property called ClientTime and LanguageCode which gives you access to the client browser’s timezone so you can accurately create and convert dates and times to whatever locale the user is in and convert them back to whatever the server is using.

If you’re storing dates, I suggest storing the SecondsFrom1970 double because you can just create a new DateTime using the locale and timezone to get strings that are appropriate for display.

---

<div class="post-metadata">

**Author:** ![David\_Cox](https://forum.xojo.com/user_avatar/forum.xojo.com/david_cox/32/227_2.png) [@David\_Cox](https://forum.xojo.com/u/David_Cox)\
**Post date:** [October 23, 2025, 6:59am UTC](https://forum.xojo.com/t/what-is-the-best-date-datatype-to-use-in-a-web-app-when/86795/3 "2025-10-23T06:59:46Z")

</div>

If you’re talking about the SQL data type then use **TimeStamp** as it’s available within most SQL database brands (more than any other).

---

<div class="post-metadata">

**Author:** ![Maximilian\_Tyrtania1](https://forum.xojo.com/user_avatar/forum.xojo.com/maximilian_tyrtania1/32/16871_2.png) [@Maximilian\_Tyrtania1](https://forum.xojo.com/u/Maximilian_Tyrtania1)\
**Post date:** [October 23, 2025, 2:59pm UTC](https://forum.xojo.com/t/what-is-the-best-date-datatype-to-use-in-a-web-app-when/86795/4 "2025-10-23T14:59:15Z")

</div>

Timestamp with time zone in particular. Postgres has full support for it.

---

<div class="post-metadata">

**Author:** ![Tim\_Parnell](https://forum.xojo.com/user_avatar/forum.xojo.com/tim_parnell/32/161_2.png) [@Tim\_Parnell](https://forum.xojo.com/u/Tim_Parnell)\
**Post date:** [October 23, 2025, 3:05pm UTC](https://forum.xojo.com/t/what-is-the-best-date-datatype-to-use-in-a-web-app-when/86795/5 "2025-10-23T15:05:58Z")

</div>

I always store date times in GMT / UTC (which `SecondsFrom1970` is). Time zone is more a “display time” application in my mind. Kind of the way you would store currency in the equivalent of pennies and only ever add symbols when its time to display.

I’m not sure if it’s best practice, but I really like how ActiveRecord stores the `SQLDateTime` string because then I can read the value easily when in the database. It is a few more steps to ensure that is UTC though.

---

<div class="post-metadata">

**Author:** ![Tim\_Seyfarth](https://forum.xojo.com/letter_avatar_proxy/v4/letter/t/d26b3c/32.png) [@Tim\_Seyfarth](https://forum.xojo.com/u/Tim_Seyfarth)\
**Post date:** [October 23, 2025, 9:43pm UTC](https://forum.xojo.com/t/what-is-the-best-date-datatype-to-use-in-a-web-app-when/86795/6 "2025-10-23T21:43:12Z")

</div>

Using a TimeStamp with TimeZone on a cloud server, means that a conversion would have to be performed when the data is input. Isn’t this the same as using secondfrom1970?

For example, if the cloud server is in the UK, a user in Germany - that has a different time zone - would not be the same time. So server side stuff would have the wrong time (UK time).

This is the scenario I want to avoid. I want the data stored on the server to reflect the actual date/time of the user.

Perhaps I am missing some logic here…

Tim
