Sometime it can be required to calculate the time since an user has joined the website or registered. ExpressionEngine stores member’s registration date/time with member data so we can calculate the time (in years, months and days) since member had registered.

It will be better to use Query Module to perform the SQL query into template.

{exp:query sql=“SELECT

FLOOR(DATEDIFF(CURDATE(), FROM_UNIXTIME(join_date))/365) AS since_years,
FLOOR((DATEDIFF(CURDATE(), FROM_UNIXTIME(join_date))/365 - FLOOR(DATEDIFF(CURDATE(), FROM_UNIXTIME(join_date))/365))* 12) AS since_months,
CEILING((((DATEDIFF(CURDATE(), FROM_UNIXTIME(join_date))/365 - FLOOR(DATEDIFF(CURDATE(), FROM_UNIXTIME(join_date))/365))* 12) - FLOOR((DATEDIFF(CURDATE(), FROM_UNIXTIME(join_date))/365 - FLOOR(DATEDIFF(CURDATE(), FROM_UNIXTIME(join_date))/365))* 12))* 30) AS since_days
FROM 360_members
WHERE member_id = 0”}

[Member Name] is member since {since_years} years, {since_months} months and {since_days} days.

{/exp:query}

ABOUT US

We offer full range of creative services, from design to development, multimedia, e-commerce, CMS development and mobile application development

We are expert in CMS's like ExpressionEngine, Craft CMS, Statamic, WordPress and many others.

MORE

CONTACT US

+91(522)-4081932

SEND US A MESSAGE
Message has been sent to us.
Error sending your message.