• user warning: Unknown column 'u.signature_format' in 'field list' query: SELECT c.cid as cid,, c.nid, c.subject, c.comment, c.format, c.timestamp,, c.mail, c.homepage, u.uid, AS registered_name, u.signature, u.signature_format, u.picture,, c.thread, c.status FROM comments c INNER JOIN users u ON c.uid = u.uid WHERE c.nid = 19517 AND c.status = 0 ORDER BY c.cid LIMIT 0, 50 in /var/www/ on line 991.
  • warning: file_get_contents( [function.file-get-contents]: failed to open stream: HTTP request failed! in /var/www/ : eval()'d code on line 4.

Timestamp mon amour (4th and final)

by Olivier Deschanels


This blog post is the final in a four-part series written in French in September 2009.

To finish this series, here are a few items allowing us to further appreciate the usefulness of timestamps.



- One could object that calculating timestamps takes time in interpreted databases. This is debatable, but there is nevertheless the possibility of doing better. in fact, with 4D v11 SQL, an interpreted database can callcompiled components. Nothing is is stopping you from accelerating your application, if need be, by offloading timestamp-related calculations to a specialized component.


- If, like me, you develop applications published on the Web, you'll undoubtedly need to display dates and times in your users' time zones. You'll appreciate the ability to subtract (or add) 3600 seconds per hour of time difference. You no longer need to verify whether the date needs to change. There's no more hassle of Australian time zones that differ by half-hour blocks, or 15-minute blocks in certain Pacific islands.


- To round off timestamps to the minute (and eliminate seconds), you just need to round the timestamp to 60:


- If in order to optimize your code you're using arrays, you will definitely prefer to use one single array rather than two... 


- To display a timestamp, you need to convert it to something legible. But there's no need to pass an additional variable in your formula, because as of version 11, you can directly place an expression in the properties list of a variable instead of its name.


RSS 0 comment(s) to this post