SharePoint Web Services and UTC time fun and games

SharePoint is designed that people can use it from multiple time zones. For example, you might have offices in London, Paris and New York. 0700 hours in New York is not the same time as 0700 in Paris, as many transatlantic telephone calls will attest to. Further, many nations have a ‘summer’ and ‘winter’ time, which seems to have been introduced to annoy dairy farmers and computer programmers.

Thus, SharePoint needs a common way to store these times. It does this using UTC time (Coordinated Universal Time). This is, near enough, GMT, and it’s also called Zulu by pilots, the military, and pedants. 0700Z (the Z represents ‘Zulu’ as in ISO8601) is the same time whether you’re in London or Sydney – just in Sydney, 0700 Zulu is actually in the evening.

Now, you don’t need to worry about this, ‘cos SharePoint is smart enough to translate your local time to UTC when you set a date and time, and to translate it back again when displaying the date to you. Thus, 0700 in New York would be stored as 1100Z in the SharePoint database, and then when you looked at that document’s properties, it would be converted back to 0700. If you looked at the document in, say, London, it would convert 1100Z to 1200. (Well, all this is as happens today – summer/winter time makes things really hairy).

So where am I going with this? I have an application where you fill in a date and time, and submit it to SharePoint. When I get the dates back, though, the time is out by an hour. I’m in the UK and it’s summertime, so my timezone is actually UTC+1; therefore, time conversions seem likely to be the issue. Continue reading “SharePoint Web Services and UTC time fun and games”

SharePoint Web Services and UTC time fun and games

The curious incident of the date column in the night-time

I have been tearing my hair out over a problem with dates and timezones. We have a site column ‘Document Date’ that we are using in our search results page. It only holds a date.

Our client noticed that some dates appeared on the search results page as a day earlier than the value in the lists themselves. For example, the list would show a document date of the 8th of May, but the search results would show the 7th of May. Curious, and the start of a bit of a detective story… Continue reading “The curious incident of the date column in the night-time”

The curious incident of the date column in the night-time

Setting the date format on SharePoint's Central Admin Site

This blew me away – Central Admin in SharePoint 2007 doesn’t have any ‘Regional Settings’. Now, at one level, this might make sense – perhaps you always want it to match, say, the server time, or UTC time. I’m not convinced, but it might make sense.

<rant>What absolutely doesn’t make sense is that the date format it uses is the stupid American ‘mm/dd/yyyy‘ format. Why can the US not accept that the rest of the Gregorian calendar using world (i.e. nearly everywhere else) uses a format of ‘dd/mm/yyyy‘? I mean, isn’t sensible to have a format that offers a gradiated precision of time, rather than dumping the most specific part of it in the middle? Or, if we wanted to accept that central admin will probably only be used by techies, what’s wrong with ‘yyyy-mm-dd‘? Hell, I’d nearly prefer Javascript’s ‘milliseconds since the start of 1970‘ format (nearly, but not quite).

Make the format configurable, or use a standard format like ‘yyyy-mm-dd’. </rant>

I did find some solutions though – I particularly like the way that is transpires that the regional settings page is there, but that you have to enter the URL by hand…

Setting the date format on SharePoint's Central Admin Site

The Curious Incident of Saving a Word document to MOSS in the night-time…

Well, okay, night-time has little to do with it.

When I try to save aWord document, I get shown the ‘Save As’ dialog.

Word Save As dialog

On it there is the ‘Favorite’ panel (UK English clearly doesn’t apply) and the option of ‘My SharePoint Sites’. Great! Wrong! If I click on the the ‘My Site’ shortcut, it changes the name of my document (‘fixer.docx’ in this case’), and if I double click, it tries to save the document as a file called .docx. The error I then get it ‘Word did not save the document.http://moss:4000/personal/burnsaw/.docx&#8217;.

Well, I can see why the error in saving, but huh? What happened to the file name? It wasn’t even the wrong file name of ‘My Site’ – there was no file name at all!

Step two was to repeat, but try using the Word’s ‘Publish > Document Management System’, but got the same result.

Step three was to open up a new document from the library, and try saving back. This highlighted another problem we’ve got – users getting prompted for network credentials when opening a document from SharePoint (this doesn’t happen every time, just the first time each user session). That accepted, it worked and opened a Word document. I typed some text, and did a ‘Save As’. I was shown this dialog:

Word Save As for SharePoint dialog

Hmm. That’s more promising, and it does save to that library correctly. So what do I notice? Well, the address bar is quite different, which is unsurprising as the top one is looking at a folder of local shortcuts. But the URL it’s pointing to is correct.

I don’t know what is going on here, but it has that irritating WebDav feel to it.

The Curious Incident of Saving a Word document to MOSS in the night-time…