The SharePoint Now function will return the token serial number of the current date and time. Dates are stored internally as sequential serial numbers to enable calculations starting from December 31, 1899 (serial number 1). These follow the same rules as the Today Function with the difference that the number will contain a decimal part for the time.
Usage
It has no parameters, so nothing to configure. Usually, you’ll need this function either as a default value for a column or as a calculation to a jump to a specific point in time.
If you want to manipulate time you need to think that, since it’s a decimal value, 1 is 24 hours or a full day, so if you’re going to calculate the date and time, for example, in 12h you need to do the following:
=NOW()+0.5
Here’s the formula that you can use to calculate the hours, minutes, and seconds. Just add or remove the result to the date/time to get the intended result.
=(<HOURS>/24)+(<MINUTES>/(24*60))+(<SECONDS>/(24*60*60))
Easy right?
To make it clear, let’s add 2 hours 30 minutes and 10 seconds to the current date/time. Based on the formula we’ll get “0,104282407”, so you need to do the following:
=NOW()+0,104282407
To make your life easier, I’ve made an Excel, so you need to download it and get the value that you need to add.
Limitations
Although the reference indicates that we cannot use it in calculated fields, we can include it and get something. We’ll get the token for today’s date and time. You can quickly test this by creating a calculated field, use the formula below, and select “Single line of text” in the “The data type returned from this formula is:“
=NOW()
It will return the token.
To get the date/time, we need to pick the “Date and Time” in the “The data type returned from this formula is: “ when configuring the calculated field.
Recommendations:
- Use this field only as a default value or to calculate differences in dates and times.
- Don’t try to parse the tokens yourself. It’s a pain, and there are a lot of more natural ways to achieve the same result. Use the formula and then add or remove the values that you get from the Excel. It will make your life easier.
- Be aware of the timezones. Double-check if the date and time you’re expecting are displayed. Otherwise, you may try to debug a problem when the only issue is that it’s shown in another timezone.
Sources:
Microsoft’s SharePoint Now Function Reference
Introduction to SharePoint formulas and functions
Back to the SharePoint’s list formula reference.
Featured Image by Gary Butterfield on Unsplash