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

ExpiryDate to show current date

Quote Reply
ExpiryDate to show current date
I would like to use the ExpiryDate to show current date and time left to a link, unfortunately it displays in Unix. I found some old code in the forum and changed it a bit but am getting odd results can someone help with this.

ExpiryDate: 2009/8/20 00:00:00
Results: 1975-06-04


Code:[/code]sub {
my $ExpiryDate = shift;
return ($ExpiryDate)
? GT::Date::date_get($ExpiryDate, $CFG->{currentdatetime}) : '';
}[/code]
Thanks in advance for any help


Sandra Roussel
Chonsa Group Design - Fresh Start Housing
Quote Reply
Re: [SandraR] ExpiryDate to show current date In reply to
What value do you have for the ExpiryDate ?

Try this global:

Code:
sub {
return localtime ($_[0]);
}

Chers

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] ExpiryDate to show current date In reply to
now I am getting: Sun Apr 6 02:00:44 1975

I input the date in this format: 2009/8/20 00:00:00


Sandra Roussel
Chonsa Group Design - Fresh Start Housing

Last edited by:

SandraR: Aug 18, 2009, 1:27 AM
Quote Reply
Re: [SandraR] ExpiryDate to show current date In reply to
What happens if you do :

<%ExpiryDate%>

? Sounds like the expiry date is messed up or something.

Cheers

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] ExpiryDate to show current date In reply to
Just using the <%ExpiryDate%> I get the defualt text: 2147483647



Sandra Roussel
Chonsa Group Design - Fresh Start Housing
Quote Reply
Re: [SandraR] ExpiryDate to show current date In reply to
Mmm, that global works perfecto for me:

http://gossamerlinks.com/.../page.cgi?d=1;p=test

I'm calling it with:

<%test(2147483647)%>

Make 100% sure you are passing the right tag along :) (cos the address you are showing, looks like what s happening is that the timestamp isn't actually being passed to the global)

Example of how you should call it:

Code:
<%global_name($ExpiryDate)%>

Cheers

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] ExpiryDate to show current date In reply to
Now I am getting this:
Mon Jan 18 21:14:07 2038

leftsidebar

using global display_expiry_date:
Code:
sub {
return localtime ($_[0]);
}

<%display_expiry_date($ExpiryDate)%>


Sandra Roussel
Chonsa Group Design - Fresh Start Housing
Quote Reply
Re: [SandraR] ExpiryDate to show current date In reply to
Hi,

Yeah, that looks more like it.

The 2038 is the date free links get (basically, in the future by a lot)

Its only links that are paid for, that will show a date like

Mon Jan 18 21:14:07 2010

(or similar)

Cheers

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] ExpiryDate to show current date In reply to
 

Well that bites - guess I will create a new field and copy the expiration date twice so I can get it to show. Unsure


Sandra Roussel
Chonsa Group Design - Fresh Start Housing
Quote Reply
Re: [SandraR] ExpiryDate to show current date In reply to
Why don't you just check the value of ExpiryDate before converting it?

The constants are in Links.pm
Code:
UNPAID => -1,
UNLIMITED => 0x7fff_fffe,
FREE => 0x7fff_ffff;

If it's greater than $ExpiryDate > UNPAID and $ExpiryDate < UNLIMITED then convert it from a unixtime (GT::Date::date_get($ExpiryDate, 'your format').

Adrian