Categories > TinyButStrong general >

Formatting DateTime (UTC)

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: MisterZ
Date: 2006-11-28
Time: 00:30

Formatting DateTime (UTC)

I ran into trouble with unix timestamps given in UTC. Formatting the datetime value with frm=[any datetime format] will return formatted datetime with LOCAL timezone applied.
Is it possible to do formatting without timezone being applied? Maybe another option besides "locale" like "UTC" can make sense...
Thanx in advance
Uwe
By: sheepy
Date: 2006-11-29
Time: 04:32

Re: Formatting DateTime (UTC)

Hmm.  TBS use strtotime and strftime/date to format date.  Have you tried passing in the unix timestamp (integer) instead of in utc format?

If it fails, you may either use ope to add/subtract timezone adjustment (not reliable if you've daylight saving), or I'd suggest date_default_timezone_set before and after the merge.
By: MisterZ
Date: 2006-12-01
Time: 00:55

Re: Formatting DateTime (UTC)

Hello sheepy,
thanx for the tip, but I do pass timestamp as integer value to my template. This value is generated in a calendar script by gmmktime and stored in the data file. (see code as an example, will print all but entered datetime if not having server TZ set to UTC...)
echo date ('d-m-Y H:i',gmmktime(0, 0, 0, 12, 1, 2006));

Unfortunately "date_default_timezone_set " is not available and I see no chance in editing the server env variables ;-) That's why I think the "UTC" option switch could make sense if you do not want timezone calculated befor merge...