Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2005-08-29 09:16:50

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

[plugin] [ORPHAN] upm_datetime: Display current date/time.

upm_datetime

Display current date/time.

Last edited by uli (2013-01-24 17:08:11)

Offline

#2 2005-08-29 11:38:05

Skubidu
Archived Plugin Author
Registered: 2004-10-23
Posts: 611
Website

Re: [plugin] [ORPHAN] upm_datetime: Display current date/time.

Simple plugin but very nice to use.
Thanks!

Offline

#3 2005-08-29 12:48:32

skoggy
Member
From: Westcoast of Sweden
Registered: 2005-03-27
Posts: 209
Website

Re: [plugin] [ORPHAN] upm_datetime: Display current date/time.

Thanx Mary!

Offline

#4 2005-08-29 17:50:05

jorn
New Member
Registered: 2005-08-29
Posts: 7

Re: [plugin] [ORPHAN] upm_datetime: Display current date/time.

Hello,

I want 2 clocks on my website.
Clock one displays time in Europe.
Clock two displays time in America.
Can anyone help me out?

Thanks

Offline

#5 2005-08-29 18:47:28

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: [plugin] [ORPHAN] upm_datetime: Display current date/time.

Which timezone is your Txp admin set to, the Europe or American one?

Offline

#6 2005-08-29 18:50:41

jorn
New Member
Registered: 2005-08-29
Posts: 7

Re: [plugin] [ORPHAN] upm_datetime: Display current date/time.

the european one

Offline

#7 2005-08-29 19:15:06

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: [plugin] [ORPHAN] upm_datetime: Display current date/time.

Okay, then we make up some PHP for the American clock.

  1. Find the difference in hours between the server’s time and the timezone you want.
  2. Create the PHP
  3. Put it in your page (or form).

As an example, if my server was in GMT-05:00, but I lived in GMT-7:00 and wanted to have the clock reflect where I am, the difference is -2 hours (we take away two hours from -7 to get -5).

$hours = number of hours difference
$format = the string format to use

<txp:php>
$hours = -2;
global $dateformat;
echo safe_strftime($dateformat, time() + ($hours * 3600));
</txp:php>

Does that make any sense?

(Edit: updated to supply correct code for any passers-by.)

Last edited by Mary (2005-08-30 21:56:53)

Offline

#8 2005-08-29 19:21:05

jorn
New Member
Registered: 2005-08-29
Posts: 7

Re: [plugin] [ORPHAN] upm_datetime: Display current date/time.

i don’t know if it makes sense i put youre line of code in my pagetemplate and its reaction was ’01/01/70’? this is the website im working on www.jornjorn.com
hopefully you can help me out…

Offline

#9 2005-08-29 19:37:56

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: [plugin] [ORPHAN] upm_datetime: Display current date/time.

Whoops, sorry ‘bout that. Once more? :)

Last edited by Mary (2005-08-30 20:01:57)

Offline

#10 2005-08-29 23:48:54

jorn
New Member
Registered: 2005-08-29
Posts: 7

Re: [plugin] [ORPHAN] upm_datetime: Display current date/time.

sorry it is still not working im really new to textpattern and php so… now my code says:

<p>Netherlands</p><txp:upm_datetime />
<p>United states</p><txp:php>$hours = GMT-6; global $dateformat; echo safe_strftime($dateformat, time() + $hours);</txp:php>

and it still is not working. what am i doing wrong?

tanx

Offline

#11 2005-08-30 20:01:37

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: [plugin] [ORPHAN] upm_datetime: Display current date/time.

screams Stupid Textile ate my code and I didn’t realize that. Sorry.

code

See, it needs the php tag?

Last edited by Mary (2005-08-30 21:57:26)

Offline

#12 2005-08-30 20:49:05

jorn
New Member
Registered: 2005-08-29
Posts: 7

Re: [plugin] [ORPHAN] upm_datetime: Display current date/time.

So, i paste your code in my page template.. But the time is still the same as the server time. Any idea what i’m doing wrong? Check the site www.jornjorn.com

Offline

Board footer

Powered by FluxBB