Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

How to display days since add and last modified

(Page 1 of 2)
> >
Quote Reply
How to display days since add and last modified
As subject says, I was wondering if there was a way to display:

1. Number of days since listing was added (current date - add date)
2. Number of days since listing was last modified (current date - modified date)

Is this possible via UltraGLobal or any other global?

Thanks.

Vishal
-------------------------------------------------------
Quote Reply
Re: [SWDevil.Com] How to display days since add and last modified In reply to
Hi,

Not 100% sure - but you should be able to do with something like this:


Code:
<%GT::Date::date_diff($Add_Date,GT::Date::date_get)%>

..and:

Code:
<%GT::Date::date_diff($Mod_Date,GT::Date::date_get)%>

May not be as simple as that (cos the date formats for $Add_Date and $Mod_Date are converted when passed to the template - so may require a little cleverer solution).

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] How to display days since add and last modified In reply to
hum :( not working.. its giving 0 as out put for both.. Here is what I am using:

Add Date: <%GT::Date::date_diff($Add_Date,GT::Date::date_get)%> <br>
Mod Date: <%GT::Date::date_diff($Mod_Date,GT::Date::date_get)%>

and here is the output:

Add Date: 0
Mod Date: 0

Vishal
-------------------------------------------------------
Quote Reply
Re: [SWDevil.Com] How to display days since add and last modified In reply to
Try this:

Code:
<%set today = GT::Date::date_get%>
Add Date: <%GT::Date::date_diff($Add_Date,$today)%> <br>
Mod Date: <%GT::Date::date_diff($Mod_Date,$today)%>

If not, what format do you have set in
Code:
Setup > Date Options > date_user_format
?

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] How to display days since add and last modified In reply to
Output for that code is -14495

date_user_format = %dd% %mmm% %yyyy%

Vishal
-------------------------------------------------------
Quote Reply
Re: [SWDevil.Com] How to display days since add and last modified In reply to
Ok, stab in the dark - but try:

<%set _today = GT::Date::date_get%>
<%set today = GT::Date::date_transform ($_today, "%dd% %mmm% %yyyy% ", "%yyyy%-%mm-%dd%")%>
Add Date: <%GT::Date::date_diff($Add_Date,$today)%> <br>
Mod Date: <%GT::Date::date_diff($Mod_Date,$today)%>


Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] How to display days since add and last modified In reply to
hum... back to:

Add Date: 0
Mod Date: 0

Vishal
-------------------------------------------------------
Quote Reply
Re: [SWDevil.Com] How to display days since add and last modified In reply to
Ok try some debugging:

Code:
<%set _today = GT::Date::date_get%>
<%set today = GT::Date::date_transform ($_today, "%yyyy%-%mm-%dd%", "%dd% %mmm% %yyyy%")%>
today = <%today%> <br />
Add Date: <%GT::Date::date_diff($Add_Date,$today)%> <br>
Mod Date: <%GT::Date::date_diff($Mod_Date,$today)%>

(I also fixed something, which may have been causing it not to work =))

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] How to display days since add and last modified In reply to
:( Still no success

today =
Add Date: 0
Mod Date: 0

Vishal
-------------------------------------------------------
Quote Reply
Re: [SWDevil.Com] How to display days since add and last modified In reply to
Send over GLinks details, and I'll try to take a look later / tomorrow. Really busy atm.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] How to display days since add and last modified In reply to
Check your pm.. its there And I am adding above code in link.html at the end.

Vishal
-------------------------------------------------------
Quote Reply
Re: [SWDevil.Com] How to display days since add and last modified In reply to
Hi,

You gave the wrong date format ;)

This now works:

Code:
<%GT::Date::date_set_format("%ddd% %mmm% %dd% %yyyy%")%>
<%set _today = GT::Date::date_get%>
Add Date: <%GT::Date::date_diff($_today,$Add_Date)%> <br>
Mod Date: <%GT::Date::date_diff($_today,$Mod_Date)%>


The bit in bold needs to match up to whatever you have in your "Date Options" section - otherwise it won't work.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] How to display days since add and last modified In reply to
Hey you got it..... wow.. this is just insane.. I mean it open up like a zillion new ideas on how to format or display info..

Cool.

Thanks again.

Vishal
-------------------------------------------------------
Quote Reply
Re: [Andy] How to display days since add and last modified In reply to
Hi Andy,

Was wondering on how to display age for Listing & User:

Example : I just used the dates for easy example:
So for Link it can be like :::: (Based on the Add Date)
Listed Since: April 22, 2007 (2 years 4 months 18 days)

Last Updated :::: (Based on the Mod Date)
Last Updated: April 22, 2008 (1 years 4 months 18 days)


For Users it can be like :::: (Based on the User Registration Date)
Member Since April 22, 2006 (3 years 4 months 18 days)

Vishal
-------------------------------------------------------
Quote Reply
Re: [SWDevil.Com] How to display days since add and last modified In reply to
Depends on how you are using - are you using GComm?

I'm not sure without looking, to see how the "signup date" is stored for users (bit busy to start looking I'm afraid)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] How to display days since add and last modified In reply to
Nope.. not using GCom.. just GLinks.

I noticed that there is no Date field in User Tables, so simply created one (with the name Signup_Date & Column Type as "Date"). Or in other words, its set same as Link Add Date but under user tables.

Vishal
-------------------------------------------------------
Quote Reply
Re: [SWDevil.Com] How to display days since add and last modified In reply to
Ok, and what format (when you look in mysqlman), does it show for that field?

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] How to display days since add and last modified In reply to
I just checked in the GLinks help section it shows "DATE: This stores a date defaulting to yyyy-mm-dd format"

Vishal
-------------------------------------------------------
Quote Reply
Re: [SWDevil.Com] How to display days since add and last modified In reply to
It is on the same development site that I send you last login info.

Vishal
-------------------------------------------------------
Quote Reply
Re: [SWDevil.Com] How to display days since add and last modified In reply to
Ok, well try this then:

Code:
<%GT::Date::date_set_format("%yyyy%-%dd%-%mm%")%>
<%set _today = GT::Date::date_get%>
Since Signup: <%GT::Date::date_diff($_today,user.DateField)%>

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] How to display days since add and last modified In reply to
No Success, here is what I am doing:

In footer for user_profile.html page (User Edit Profile Plugin)
am having this code
Code:
<%GT::Date::date_set_format("%yyyy%-%dd%-%mm%")%>
<%set _today = GT::Date::date_get%>
Since Signup: <%GT::Date::date_diff($_today,user.Signup_Date)%>

Output
Code:
0 Since Signup: 14497

Vishal
-------------------------------------------------------
Quote Reply
Re: [SWDevil.Com] How to display days since add and last modified In reply to
Mmm, sometimes it can be due to the user, stuff

Try doing:
Code:
<%GT::Date::date_set_format("%yyyy%-%dd%-%mm%")%>
<%set _today = GT::Date::date_get%>
<%set tmp = user.Signup_Date%>
Since Signup: <%GT::Date::date_diff($_today,$tmp)%>

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] How to display days since add and last modified In reply to
Still the same output.

0 Since Signup: 14497

Vishal
-------------------------------------------------------
Quote Reply
Re: [SWDevil.Com] How to display days since add and last modified In reply to
Ok not sure - will try and have a look later - mega busy atm.

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] How to display days since add and last modified In reply to
Thanks for the help, will be waiting for your reply.

Vishal
-------------------------------------------------------
> >