This extension calculates the time between two Unix Timestamp dates and give the result in a "human readable" format (years, months, days, hours and minutes). As an example, it can be useful to display the time passed since last login -if you stored it in a cookie or into your database-.
How to use it
1.- Open "Server Behaviors->Tecnorama->Elapsed Time"
2.- In the menu: Check/uncheck the "hours" and "minutes" checkboxes if you want to display them when using the extension: If you uncheck them, you will have something like "3 years, 1 month and 2 days". If you check them, it could be: "3 years, 1 month, 2 days, 20 hours and 15 minutes". In the textfields, you should indicate where the dates come from. time() function has been left in one of them by default, so you can check the time between one of your fields and current date. However, you can select another field, if you want to.
3.- To select the fields: click the button to open the panel where you can select your fields. Remember that you don't have to use the "format" and "code" textfields, as they are useless here.
4.- It's done: Here you can see the extension working in live data view. For this example I used an URL parameter and current date -I left time() in Field 2-. Just one more thing: dates don't need to be in a certain order (for example, current date in Field 2). The code will check it.
Remember to read this tutorial about displaying MySQL timestamps as Unix timestamps.
You can download the extension here.
|