|
Home > Archive > Microsoft Content Management Server > July 2006 > Dates always 1 hour behind
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Dates always 1 hour behind
|
|
| Andy Stephens 2006-06-27, 1:18 pm |
| Hi
Whenever I write code that uses the PAPI to examine channels and postings,
their dates (e.g. LastModifiedDate) are always an hour behind what CMS says
(e.g. in the revision history).
I thought the dates from CMS might have been in UTC format so I tried the
following:
DateTime realDate = posting.LastModifiedDate.ToLocalTime();
However this only corrects dates that fall within British summer
time/daylight savings, while winter dates still appear an hour behind. Is
there something else that I need to use?
Regards
Andrew
| |
| Randall 2006-06-27, 1:18 pm |
| Hi Andy,
Try this.
DateTime realDate=
System.DateTime.Parse(posting.LastModifiedDate.ToShortDateString());
This should work.
Randall
"Andy Stephens" wrote:
> Hi
>
> Whenever I write code that uses the PAPI to examine channels and postings,
> their dates (e.g. LastModifiedDate) are always an hour behind what CMS says
> (e.g. in the revision history).
>
> I thought the dates from CMS might have been in UTC format so I tried the
> following:
>
> DateTime realDate = posting.LastModifiedDate.ToLocalTime();
>
> However this only corrects dates that fall within British summer
> time/daylight savings, while winter dates still appear an hour behind. Is
> there something else that I need to use?
>
> Regards
> Andrew
| |
| Randall 2006-06-27, 7:16 pm |
| I am sorry. We don't need to use ToShortDateString() if you want time to.
Randall
"Randall" wrote:
[vbcol=seagreen]
> Hi Andy,
>
> Try this.
> DateTime realDate=
> System.DateTime.Parse(posting.LastModifiedDate.ToShortDateString());
>
> This should work.
>
> Randall
>
> "Andy Stephens" wrote:
>
| |
| Andy Stephens 2006-06-28, 7:23 am |
| Sorry, that didn't work. If I try
DateTime realDate=
System.DateTime.Parse(posting.LastModifiedDate.ToShortDateString());
It loses the time part!
| |
| Stefan [MSFT] 2006-07-06, 7:20 am |
| Hi Andrew,
this should not happen.
Sounds as if your machine is not configured to maintain the authomatic
switch of the daylight savings time.
Please double check.
Cheers,
Stefan
--
This posting is provided "AS IS" with no warranties, and confers no rights
New to MCMS?
Check out this book: Building Websites Using MCMS: http://tinyurl.com/6zj44
Check out the new book as well: Advanced MCMS development:
http://tinyurl.com/8ugwj
----------------------
"Andy Stephens" <andrew.stephens@cheshire.gov.uk-donotspam> wrote in message
news:2E0BB911-8538-475B-BDA5-F651374C5377@microsoft.com...
> Hi
>
> Whenever I write code that uses the PAPI to examine channels and postings,
> their dates (e.g. LastModifiedDate) are always an hour behind what CMS
> says
> (e.g. in the revision history).
>
> I thought the dates from CMS might have been in UTC format so I tried the
> following:
>
> DateTime realDate = posting.LastModifiedDate.ToLocalTime();
>
> However this only corrects dates that fall within British summer
> time/daylight savings, while winter dates still appear an hour behind. Is
> there something else that I need to use?
>
> Regards
> Andrew
|
|
|
|
|