Skip to main content
Commonmark migration
Source Link

###Not the best tool for the job.

Not the best tool for the job.

I frequently use database systems strictly for date-time calculations. Because they are really good at it. A Code Review regular once said:

Never calculate date time by hand. This rule is more important than not using GoTo statements...

Database connectors for Java are easy to make, and you just need a few stored functions/procedures to do the job more accurately than any human could.

Example?

SELECT DATEADD(MINUTE, 29723947, CURRENT_TIMESTAMP);
-------------
2071-12-30 17:05:59

Another?

DECLARE @FallOfBerlinWall DATE = '1990-10-03';
SELECT DATEDIFF(SECOND, @FallOfBerlinWall, CURRENT_TIMESTAMP);
--------- 
780372479

###TL:DR;

TL:DR;

Don't calculate date-time by hand.

###Not the best tool for the job.

I frequently use database systems strictly for date-time calculations. Because they are really good at it. A Code Review regular once said:

Never calculate date time by hand. This rule is more important than not using GoTo statements...

Database connectors for Java are easy to make, and you just need a few stored functions/procedures to do the job more accurately than any human could.

Example?

SELECT DATEADD(MINUTE, 29723947, CURRENT_TIMESTAMP);
-------------
2071-12-30 17:05:59

Another?

DECLARE @FallOfBerlinWall DATE = '1990-10-03';
SELECT DATEDIFF(SECOND, @FallOfBerlinWall, CURRENT_TIMESTAMP);
--------- 
780372479

###TL:DR;

Don't calculate date-time by hand.

Not the best tool for the job.

I frequently use database systems strictly for date-time calculations. Because they are really good at it. A Code Review regular once said:

Never calculate date time by hand. This rule is more important than not using GoTo statements...

Database connectors for Java are easy to make, and you just need a few stored functions/procedures to do the job more accurately than any human could.

Example?

SELECT DATEADD(MINUTE, 29723947, CURRENT_TIMESTAMP);
-------------
2071-12-30 17:05:59

Another?

DECLARE @FallOfBerlinWall DATE = '1990-10-03';
SELECT DATEDIFF(SECOND, @FallOfBerlinWall, CURRENT_TIMESTAMP);
--------- 
780372479

TL:DR;

Don't calculate date-time by hand.

Source Link
Phrancis
  • 20.4k
  • 6
  • 68
  • 154

###Not the best tool for the job.

I frequently use database systems strictly for date-time calculations. Because they are really good at it. A Code Review regular once said:

Never calculate date time by hand. This rule is more important than not using GoTo statements...

Database connectors for Java are easy to make, and you just need a few stored functions/procedures to do the job more accurately than any human could.

Example?

SELECT DATEADD(MINUTE, 29723947, CURRENT_TIMESTAMP);
-------------
2071-12-30 17:05:59

Another?

DECLARE @FallOfBerlinWall DATE = '1990-10-03';
SELECT DATEDIFF(SECOND, @FallOfBerlinWall, CURRENT_TIMESTAMP);
--------- 
780372479

###TL:DR;

Don't calculate date-time by hand.