Search the FirstSpirit Knowledge Base
Hello,
In my application there is page which displays news_teaser sections.Based on the timezone news will get expire.
1.Server is located in Germany.
2.News entry was created in India(Locale).
Form:
<CMS_INPUT_DATE name="csExpirationDate" noBreak="yes" useLanguages="no">
<LANGINFOS>
<LANGINFO
lang="*"
label="Expiration Date"
description="The date, the news expires"
format="yyyy-MM-dd HH:mm:ss Z"
length="20"/>
<LANGINFO
lang="DE"
label="Ablaufdatum"
description="Datum an dem die Nachricht ungültig wird"
format="dd.MM.yyyy HH:mm:ss Z"
length="20"/>
</LANGINFOS>
</CMS_INPUT_DATE>
Here csExpirationDate is mapped to database column "expirationdate" and datatype as Date
In News Template Date and Time selection(User Locale is here India),
HTML Template Code:
$CMS_SET(setExpirationDay,content.expirationdate)$
When i run the deployment and verified the Atom feed Generated XML for news entry,Below is the out put.
<!-- setExpirationDay1: $CMS_VALUE(setExpirationDay)$ -->
<!-- setExpirationDay21: $CMS_VALUE(setExpirationDay.format("yyyy-MM-dd'T'hhmmssZ"),default:"")$ -->
Output:
<!-- setExpirationDay1: 02-Oct-2014 -->
<!-- setExpirationDay21: 2014-10-02T082051+0200 -->
I am just formatting the "setExpirationDay" field.
Why Here +0200 is displayed as timezone???(Its based on UTC + 2 hrs for Germany Locale difference)
But it should be as +0530(UTC difference for Locale India)
1.Is First Spirit store the expirationdate as Locale germany in the database itself?
2.Why this behavious is happening?
Thanks,
Siva
FirstSpirit stores dates locale independent. And 11:50 in India is 8:20 in Germany (at least for german summer time).
If you want/need the output in a specific time zone, you should specify this in your template. E.g. like this: $CMS_VALUE(date.format("yyyy-MM-dd'T'HHmmssZ", class("java.lang.Locale").new("hi_IN")))$
Hello Peter Jodeleit,
Thanks for your kind reply.Yes you are correct.
But unfortunately while creating the new news we dont know under which country(Locale) the news is created.We cant track it.We dont want to create new combob box for selection of Locale.
So i modified XML lap feed generation based on UTC timezone.So All over the world who ever access the system news will get expired on time.Client request also based on UTC based now.
Thank you...