How I Store Dates and Money in Financial Applications

Iniciado por joomlamz, Hoje at 06:25

Respostas: 0   |   Visualizações: 2

Tópico anterior - Tópico seguinte

0 Membros e 1 Visitante estão a ver este tópico.

How I Store Dates and Money in Financial Applications



Tópico: How I Store Dates and Money in Financial Applications
Categoria: Tutoriais | Programação & Tecnologia
Idioma Principal: Português (Conteúdo de Tecnologia)

Descrição do Conteúdo / Informações:
-------------------------------------------------------------------------
PRO TIP!

I've been developing a financial records app for the last 30 days.

Along the way, I realized there are two fundamental problems that almost every financial app needs to solve:

• Recording dates

• Recording money amounts

Here is my tips (I have 2 useful tips):

❶ Store dates in UTC

Always store dates in UTC (or as Unix timestamps/milliseconds). It makes your app much easier to use across different time zones and regions.

❷ Store money in the smallest currency unit

Instead of storing decimal values, store amounts in the smallest unit of the currency.

For example, with Indonesian Rupiah (if you choose to support two decimal places for consistency across currencies):

• User sees: IDR 1,000,000

• Database stores: 100,000,000 (smallest unit)

This approach solves two common problems:

• You can safely use integer data types, which are supported by almost every database, from SQLite to PostgreSQL, without worrying about floating-point precision.

• Your app becomes easier to adapt to multiple currencies, since many of them (USD, MYR, SGD, etc.) already use smaller subunits like cents.

If you are interested to try my app, visit Where Did My Money Go? for Android

Fill this form, so I can add you as early tester. Google Form

That's all. Hope this helps! 😁


Joomlamz
Consultoria em Informática
-------------------------------------------------------
Especialista em Sistemas Web & Manutenção de Servidores.
A desenvolver o novo AplPortal com suporte a PHP 8.
Precisa de ajuda profissional? Contacte-me.

Tags: