This topic isn't really Umbraco related, but I'm using the Twitter for Umbraco package (which is great!) and the time from all tweets is wrong. It's 2 hours behind. The created_at date says 09:00, but it was created on 11:00. Is it because of a different time zone?
Also is there an easy way to show "3 hours ago" as the time instead of the create date?
Hi Jeroen, I would check the XML feed directly from twitter to see what times is being returned. Unfortunately my package cant do anything to help with that.
I am not sure if there is a timezone setting in your twitter account on twitter.com this could affect these time/date values if not then you will need to add some logic into your XSLT to either add or substract from the XML date/time to suit your needs.
I've check the XML feed directly from twitter and there the time is also wrong. For now I just add 2 hours to the time and everything is fine, but that's not the best solution off course.
As far as I can tell, the date in the feed looks like this:
"Wed Aug 25 19:40:45 +0000 2010"
Is that correct? If so, then the "+0000" indicates that the time is in UTC, meaning that it has a 0 offset. So it makes perfect sense, that the date might be a couple of hours off the time you expect because of timezones/daylight savings.
A solution could be that the CWS.Twitter:FormatTwitterDate(created_at) method parses the date as being UTC, and the converts it into local time (meaning the servers time setting). That would work for 90% of people. Alternatively, supply an overload allowing to pass in a timezone that the time should be converted to.
Just changed the method a bit to convert to local time. Was looking at making an overload for changing timezones, but that got pretty messy very quick, when starting to think about daylight savings and all... So for now:
public static string FormatTwitterDate(string twitterDate)
{
DateTime parsedDate;
if (DateTime.TryParseExact(twitterDate, "ddd MMM dd HH:mm:ss zzz yyyy", CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal, out parsedDate))
{
return parsedDate.ToLocalTime().ToString("s");
}
return "1900-01-01T00:00:00";
}
Should fit most needs.
As an instant fix, you can just add this method as inline C# in the xslt until there is an updated package...
Wrong twitter time
Hello,
This topic isn't really Umbraco related, but I'm using the Twitter for Umbraco package (which is great!) and the time from all tweets is wrong. It's 2 hours behind. The created_at date says 09:00, but it was created on 11:00. Is it because of a different time zone?
Also is there an easy way to show "3 hours ago" as the time instead of the create date?
Jeroen
Hi Jeroen,
I would check the XML feed directly from twitter to see what times is being returned.
Unfortunately my package cant do anything to help with that.
I am not sure if there is a timezone setting in your twitter account on twitter.com this could affect these time/date values if not then you will need to add some logic into your XSLT to either add or substract from the XML date/time to suit your needs.
Thanks,
Warren :)
Hi Warren,
I've check the XML feed directly from twitter and there the time is also wrong. For now I just add 2 hours to the time and everything is fine, but that's not the best solution off course.
Jeroen
Jeroen,
I know its not the best solution. However I have no control over the XML feed ;)
Warren
As far as I can tell, the date in the feed looks like this:
"Wed Aug 25 19:40:45 +0000 2010"
Is that correct? If so, then the "+0000" indicates that the time is in UTC, meaning that it has a 0 offset. So it makes perfect sense, that the date might be a couple of hours off the time you expect because of timezones/daylight savings.
A solution could be that the CWS.Twitter:FormatTwitterDate(created_at) method parses the date as being UTC, and the converts it into local time (meaning the servers time setting). That would work for 90% of people. Alternatively, supply an overload allowing to pass in a timezone that the time should be converted to.
Hope that makes sense :-)
Morten & Jeroen,
The package is open source and is open to contributors if you want to help fix or improve twitter for umbraco.
I just sturggle to find time to keep up to date with all my packages.
Warren :)
I can fix the date method if you want? Just need codeplex access :)
Just changed the method a bit to convert to local time. Was looking at making an overload for changing timezones, but that got pretty messy very quick, when starting to think about daylight savings and all... So for now:
Should fit most needs.
As an instant fix, you can just add this method as inline C# in the xslt until there is an updated package...
Hi Morten do you want to become a contributor and work on obviously adding this and maybe any other ideas or improvements you may have?
Cheers,
Warren :)
Sure thing. You can add me on codeplex: "mortenbock".
Will check in the changes, and then we can coordinate how the packaging works :)
Added you on Codeplex, if you add yourself or send request to be a contributor on our.umbraco.org project page then I can add you there as well.
Cheers,
Warren :)
Added you on Codeplex, if you add yourself or send request to be a contributor on our.umbraco.org project page then I can add you there as well.
Cheers,
Warren :)
@Morten. Can you tell me what I need to do to inline your quick fix in the xslt? How should the exact code look?
is working on a reply...