Gossamer Forum
Home : Products : Gossamer Mail : Discussion :

How Do I Do Users Join Time Conversion

Quote Reply
How Do I Do Users Join Time Conversion
Hi,

The Users table has the Users_join_time stored as unix_timestamp. I would want the same to be stored in the dgraph table in yyyy-mm-dd format automatically once the account is validated.

can someone help on this plzzz.

Thnx

Anup
Quote Reply
Re: [anup123] How Do I Do Users Join Time Conversion In reply to
What do you need this timestamp for? If you just want to use the timestamp in templates, then you can just convert it using GT::Date. You would use something like:
Code:
<%GT::Date::date_get($users_join_time)%>
By default, it will output the date in yyyy-mm-dd format. If you want to change the format then the following should work:
Code:
<%GT::Date::date_set_format("format goes here")%><%GT::Date::date_get($users_join_time)%>
The formats are described at the top of the file admin/GT/Date.pm and also in the admin => Setup => Dates.

Adrian
Quote Reply
Re: [brewt] How Do I Do Users Join Time Conversion In reply to
Thnx.

The date coversion worked. i need to insert this date in the Template. that worked. I also need to insert this into the dgraph_actdate. How can that be done.

As an extension, I want one year added to this date. Can you please help on this? Adding a Year to this date and inserting thses two dates in respective columns in dgraph table. In fact I would want this to happen the moment the account is Validated. Any help?

Thnx

Anup

Last edited by:

anup123: Jul 6, 2002, 3:18 PM
Quote Reply
Re: [brewt] How Do I Do Users Join Time Conversion In reply to
Hi,

Suppose I want to add 1 year to $users_join_time and diplay it in template.I tried the following but it always returns 01.01.1971. Can I be corrected on the following which is yielding 01.01.1971 always

<%GT::Date::date_set_format("%d%-%mm%-%yyyy%")%><%GT::Date::date_add($users_join_time, 365)%>

I want to display the date by including the same on template folders_include.htm

Thnx

Anup
Quote Reply
Re: [anup123] How Do I Do Users Join Time Conversion In reply to
I think what you really want to do here is something like:
Code:
<%GT::Date::date_set_format("format goes here")%>
<%set expiry_time = $users_join_time + 31536000%>
<%GT::Date::date_get($expiry_time)%>

$users_join_time is a unixtime, so you can't just add 365 to it. You need to add 31536000, which is the number of seconds in a year (365 * 60 * 60 * 24).

Adrian
Quote Reply
Re: [brewt] How Do I Do Users Join Time Conversion In reply to
Hi,

But this is just returning the $users_join_time in Human readable format....

And setting the format to %dd%-%mm%-%yyyy% always gives additional leading zeros???

like 0011-07-2002?

Anup
Quote Reply
Re: [brewt] How Do I Do Users Join Time Conversion In reply to
The above is always returning the $users_latest_login ???

I am sorry for my previous post. its nor $users_join_time but it is $users_latest_login time which is displayed with the above sum. How could GT::Date::date_add be used? Or it can't be used at all for this purpose?

Why so?

Thnx

Anup


=_= =_= =_= =_= =_= =_=


You can chain me, you can torture me, you can even destroy this body, but you will never imprison my mind.
-Mahatma Gandhi