Virtual Happy Hour this month, Jun 28, we'll be getting a sneak preview at our soon to launch SaaS CMS!

Try our conversational search powered by Generative AI!

Time zone problem

Vote:
 

Hi,

I'm fairly new to C# and totally new to EPiServer. I'm trying to learn so that I can participate in development.

(All dates and times below are correct if you assume them to be GMT+1 instead of the specified type. I wrote this topic during the course of a day which is why the times are so widely spread out.)

I create a [Public] Standard Page which I name CreationDateTest. Its Start publish date and time is set to 2010-02-08 15:54 which was the local (on the server) date and time when I started creating the page. I enter some content into the text body and click Save and Publish.

When I look at the page from View Mode I fint this meta information:

<meta_name="creation_date" content="Mon, 08 Feb 2010 15:54:00 GMT"/>

With my own emphasis in bold above. The date and time is presented as GMT even though I'm located in Sweden which uses GMT+1. I think that this issue is related to me having configured something incorrectly. What I have done is:

  • Using Control Panel / Date and Time Properties / Time Zone I choose (GMT+01:00) ..., Stockholm, ... as well as Automatically adjust clock for daylight saving changes.

What I would like the meta information to say is for this specific case is:

<meta_name="creation_date" content="Mon, 08 Feb 2010 15:54:00 GMT+1"/>

I have used a break point in my EPiServer based application and used the Immediate window to gather some information:

DateTime.Now
{2/8/2010 5:07:53 PM}
    ...

If I on the other hand do the same in a normal console application I get:

DateTime.Now
{2010-02-08 17:13:31}
    ...

For both of the above cases I get:

TimeZone.CurrentTimeZone
{System.CurrentSystemTimeZone}
    [System.CurrentSystemTimeZone]: {System.CurrentTimeZone}
    DaylightName: "W. Europe Daylight Time"
    StandardName: "W. Europe Standard Time"

What configuration can I have missed? I've only set the local time in Windows so I assume there is something else I need to configure as well.

#36712
Feb 08, 2010 17:41
Vote:
 

Thank you for your answer Anders. What I'm looking for is the standard way of handling date and times. Your blog entry seems to describe a bit more complicated scenario. I'm simply curious about why my site used english regional settings.

I found out that it was a configuration in web.config which I corrected in the global configuration. It works now. Thanks again for your answer!

#36754
Feb 10, 2010 9:04
Vote:
 

Hi Kent

Exactly what configuration was it that you changed.

Tanks in advanced

/Henrik

#37187
Feb 23, 2010 15:04
Vote:
 

Sorry I don't have the installation anymore. It was a virtual machine which has since been deleted. But the change I made was in web.config and concerned time zone. So if you search for time zone, date, zone, local in web.config you ought to find it. It was set to GMT while I'm in a GMT+1 zone, so I changed it and it worked. Good luck!

#37268
Mar 01, 2010 8:45
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.