I had a problem recently with a Sitecore system I was working on. We had 4 machines involved – a development server, a content management server (CM), and two content delivery (CD) servers. The problem was, for the ‘News Search’ page we would get different number of items on the CD servers than the CM or development systems.
CM and Dev would return 8 items for a search of news from 1st April to 30th April. The CDs would return 54 items… Continue reading “How to set the Locale of a Network Service (or other System) Account”
I’m working with a Nintex workflow at the moment, and trying to do a simple thing – format a date. Unfortunately, the function fn-FormatDate does not work correctly. Continue reading “Nintex fn-FormatDate inline function failure”
Previously I’ve blogged about using ddwrt to format dates and datetimes. Well, today, I found myself trying to figure it out again, so here is a reminder. Remember, one of the big advantages of this (in the UK at least, where we are UTC time half the year) is that the DateFormat function accounts for daylight savings (i.e. the difference between GMT and BST)
Add this to the xsl:stylesheet tag at the top:
Then you can use something like the following (where item_date is an XSL variable with our date in it):
<xsl:value-of select="ddwrt:FormatDate(string($item_date), 2057, 15)" />
Here the FormatDate function is taking the string of the date, formating it for Great Britain’s locale (2057), and specifying an output format (15). Output formats vary by locale, and not all seem to be valid. I found that when I tried a format of ‘2’, for example, that I got an XSL error.
This is a particularly useful with the Content Query Web Part and the RSS Feed Web Part
So, I was playing with Date formats again in SharePoint, and came across a good tip from Panvega worth a shout – Using ddwrt:FormatDate in the CQWP. I needed to take the Publishing date for a page and reformat it (I don’t need ’14:55:47 GMT’ on the end); this allowed me to do that!
It’s quite nice that this control is available to use in my own pages/web parts, but there are issues:
Here we have in microcosm my problems with Microsoft and date/times – an assumption of the local region, and date time controls that would never be empty, right? I had exactly these same problems when writing an Outlook 2003 to SharePoint 2007 integration too. Makes me a bit annoyed! Especially as we have nullable types! Quit screwing around with DateTimes being structs, make them objects and just return me a bloody null if nothing has been selected!
Something I keep forgetting – the locale code for the UK (en-gb) is 2057. I shouldn’t have to remember that as much as I do, but SharePoint Designer’s Dataview Web Part seems to assume you’re American…
I keep forgetting this, so a note to myself. Date formats in search results in SharePoint are defined by:
- For Team Sites, the sites Regional Settings
- For Collaboration Portals, the Search Center’s Regional Settings
Now, if only I can remember that this time. Often I see systems showing the dates in American date format (don’t get me started on that one!) and this is how you change the displayed format.
Of course, this raises the question of, if you have offices in, say, London and Paris, how do you support the different time zones? Hmm. I’ll have to puzzle over that.