Page 1 of 1

OT? echo DATE_GMT offset

Posted: Sun Jan 04, 2004 3:15 pm
by mo
Hello,

I want to output a line (via ssi) on a personal web page (local) that gives me the time in Thailand (GMT+7) or exactly 12 hours from my local time. (I know I could just change AM to PM, but this has become a quest for understanding).

<!--#config timefmt="%A %B %d, %Y %I:%M %p"-->

I have tried:
<!--#echo var="DATE_GMT(+7)"-->
<!--#echo var="DATE_GMT7"-->
<!--#set var="DATE_GMT" value="+7" etc -->
<!--#echo var="DATE_GMT"-->
<!--#echo var="DATE_GMT(today7 with and without quotes double and single)"-->
<!--#echo var="DATE_GMT(today+7)"-->
<!--#echo var="date_gmt (all variations)"-->

and I have done dozens of Google searches without turning up an example
Apache is set up properly, SSI works fine.

If someone here knows what I need to do to get this to work I would appreciate it very much, thank you.

Posted: Sun Jan 04, 2004 7:44 pm
by MudGuard
As far as I know you can either print the local time (as set on the machine on which the apache is running) or the UTC time (a/k/a GMT).

I don't think you can display UTC +/- something.

SSI is a very limited serverside scripting language - maybe you should use a more powerful technology...

Posted: Sun Jan 04, 2004 9:01 pm
by mo
Thanks MudGuard...just arriving at that same conclusion right now.

WRONG! Haha. I got this from someone on the html help board, but she made me complete it myself, so although it works right now, I'm not sure if I got the concept correctly concerning later hours.

Here's the code:

Code: Select all

<p class="ctr c f2"><b>The date and time in<br />
Thailand<br />
is<br />
<!--#config timefmt="%A" -->
<!--#echo var="DATE_GMT" --><br />
<!--#config timefmt="%B %d, %Y" -->
<!--#echo var="DATE_GMT" --><br />
<!--#config timefmt="%H" -->
<!--#if expr="\"$DATE_GMT\" = \"01\"" -->
08:
<!--#elif expr="\"$DATE_GMT\" = \"02\"" -->
09:
<!--#elif expr="\"$DATE_GMT\" = \"03\"" -->
10:
<!--#elif expr="\"$DATE_GMT\" = \"04\"" -->
11:
<!--#elif expr="\"$DATE_GMT\" = \"05\"" -->
12:
<!--#elif expr="\"$DATE_GMT\" = \"06\"" -->
13:
<!--#elif expr="\"$DATE_GMT\" = \"07\"" -->
14:
<!--#elif expr="\"$DATE_GMT\" = \"08\"" -->
15:
<!--#elif expr="\"$DATE_GMT\" = \"09\"" -->
16:
<!--#elif expr="\"$DATE_GMT\" = \"10\"" -->
17:
<!--#elif expr="\"$DATE_GMT\" = \"11\"" -->
18:
<!--#elif expr="\"$DATE_GMT\" = \"12\"" -->
19:
<!--#elif expr="\"$DATE_GMT\" = \"13\"" -->
20:
<!--#elif expr="\"$DATE_GMT\" = \"14\"" -->
21:
<!--#elif expr="\"$DATE_GMT\" = \"15\"" -->
22:
<!--#elif expr="\"$DATE_GMT\" = \"16\"" -->
23:
<!--#elif expr="\"$DATE_GMT\" = \"17\"" -->
00:
<!--#elif expr="\"$DATE_GMT\" = \"18\"" -->
01:
<!--#elif expr="\"$DATE_GMT\" = \"19\"" -->
02:
<!--#elif expr="\"$DATE_GMT\" = \"20\"" -->
03:
<!--#elif expr="\"$DATE_GMT\" = \"21\"" -->
04:
<!--#elif expr="\"$DATE_GMT\" = \"22\"" -->
05:
<!--#elif expr="\"$DATE_GMT\" = \"23\"" -->
06:
<!--#elif expr="\"$DATE_GMT\" = \"00\"" -->
07:
<!--#endif -->
<!--#config timefmt="%M:%S %p" -->
<!--#echo var="DATE_GMT" -->
</p>

Took 14 hours to solve this problem. Ah the joys of madness!


Well it was an interesting attempt...trouble is it doesn't increment the day...which could be set up the same way I guess, but this starts to look a little too much since other solutions are out there.


--------------------------------------------------------------------------------