Snoozing at the OASIS
Posted on 28 Jan 2009 at 17:07
This month, Simon Jones looks into the maintenance of the ODF standard, and sizes up the new Outlook add-in Xobni.
The DateDiff() function in Visual Basic and SQL Server takes different parameters in a different order and can calculate weeks, quarters, hours, minutes and seconds as well as days, months and years between the two dates. You can call this from a cell in an Excel workbook if you wrap it up into your own public macro function.
For instance, if you put this code into a new Module in your workbook:
Public Function DateDifference(Interval As String, Date1 As Date, Date2 As Date)
DateDifference = DateDiff(Interval, Date1, Date2, vbMonday, vbFirstJan1)
End Function
then you can use this customised DateDifference() function to pass the relevant parameters on to VBA's DateDiff() function and return the result to a cell, for example = DateDifference("q", D1, D2).
The two optional parameters in DateDiff() state what the first day of the week is and when the first week of the year starts. These can be set explicitly, or else set to follow the Control Panel settings for the current computer. Beware that different Control Panel settings may then change the result of the DateDiff() function, and you might get different results on different PCs - if you need consistent results, fix these parameters to known values. Also, depending on these settings and the dates concerned, DateDif() and DateDiff() can yield different numbers of months between dates.
advertisement
- Getting to grips with Microsoft's IT Health Environment Scanner
- Virtualise your servers
- The changing face of travel gadgets
- Build your own distributed file system
- The bulletproof Dell that costs an arm and a leg
- Microsoft Office 2010 Technical Preview: Q&A
- Lawnmowers, the TyTN II and one odd insurance request
- There'll never be a bulletproof OS
- How far can we trust apps?
- Five nice touches in Outlook 2010
- Why Britain's watchdogs have fewer teeth than goldfish
- Tabbed documents: how to make Office 2010 great
- Outlook 2010 People Pane – does it spell death to Xobni
- Microsoft Outlook 2010 screenshots
- Co-Authoring in Word 2010 and SharePoint Foundation 2010
- Microsoft Outlook 2010 screenshots: Backstage view
- Flash 10.1: Developing for Desktop and Device
- Microsoft Office 2010 screenshots: Recover unsaved items
- Microsoft Word 2010 screenshots: Text Effects
- Microsoft Word 2010: inserting screenshots
- Q&A: Why Conficker was a victim of its own success
- App developers losing faith in Android
- Biz Stone: Murdoch's Google veto will "fail fast"
- Google adds automatic captions to YouTube
- China ramps up cyber spying
- Mozilla maintains dependence on Google
- Windows 7 flying off the shelves
- Google Chrome OS: full details unveiled
- AOL slashes 2,500 jobs
- YouTube begins streaming full-length shows
advertisement
Printed from www.pcpro.co.uk


