10

I have tried using =TEXT(Today,"mm-dd-yyyy hh:mm:ss") but that only returns the 5/5/55 00:00:00, it won't give the time. How do I get both the date and time with a calculated formula?

3
  • 1
    Why don't you edit your question and put down what you're trying to acheive with this, e.g. "Display red text when a task is overdue". Today in calc columns doesn't work but there are other ways to do things - so tell us what you're trying to do.
    – Ryan
    Commented Feb 24, 2012 at 8:19
  • 2
    I think he did ask a good specific question. " How do I get both the date and time with a calculated formula?" The issue is that time is always 00:00:00.000. Commented May 2, 2013 at 22:11

5 Answers 5

14

Unfortunately if you are trying to have this always show the current date and time, this won't work since Calculated Columns are not recalculated on viewing, but only on creation and modification. See this article: http://blog.pentalogic.net/2008/11/truth-about-using-today-in-calculated-columns/

However, if you are just trying to extract the time when calculated then you could switch your formula to: =TEXT([Modified],"mm-dd-yyyy hh:mm:ss")

4
  • I have tried this, but it seems the [Modified] part of the formula is not working and every time I try to save the changes to the column I get a runtime error, however [Today] will work. Does the column with this formula have to be set to a certain type or will Single line of text work? Commented Feb 23, 2012 at 19:37
  • 1
    [Today] doesn't work, never has, even with the fake today column tricks. You said so in your question - now you're saying it does. Want to clarify?
    – Ryan
    Commented Feb 24, 2012 at 8:18
  • The =TEXT([Modified],"mm-dd-yyyy hh:mm:ss") formula doesn't work if you switch a regular text field column to start using a calculated formula. For example we had a text field that got used for a bit and now the end-user wants it to generate a random number. My first instinct was to flip the radio button to "Default Value: Calculated Value" and put that formula in. This does not work because the Modified column hasn't actually been populated yet. Is there a way to get an accurate timestamp without being forced to do so within a calculated formula column specifically? Commented Feb 28, 2013 at 17:47
  • What if list is created and modified column is created . In my case , the above formula giving run time error although the list is created .
    – user27178
    Commented Jul 15, 2016 at 11:45
3

you can also Use Now() instead of Today()

=TEXT(Now(),"mm-dd-yyyy hh:mm")

a sample for date diff

=IF(NOW()<=[End Date], 
DATEDIF(NOW(),[End Date],"d"), 
DATEDIF([End Date],NOW() ,"d") * -1)
0

Sure you can, here are the methods http://office.microsoft.com/en-us/windows-sharepoint-services-help/CH010103260.aspx

2
  • 2
    Yes there are formula to extract date/time from a date field BUT [Today] does not work in calculated columns.
    – Ryan
    Commented Feb 24, 2012 at 8:17
  • That is true, you have to build it for yourself Commented Feb 24, 2012 at 8:21
0

I have a list with tasks that all have to be finished within a certain deadline. I wanted the list to show me which deadlines were getting closer or were exceeded. After a long search on the internet I found there was no satisfying solution to make a column using the current date. However, I found out that when you modify the view of a list, you can put [today] in the filter section. This allows you to base the view of your list on the current date. This date will automatically be kept current. (I have a Dutch version of SharePoint, so I hope I guessed the used terms right ;) ).

I made 3 different views of the same list on one page. For all views I edited the list view and checked the box which says only show items if under the tab filter ;

View 1, named: Deadline exceeded:

'Only show if'

'deadline' column

'smaller than'

[today]

View 2, named: Deadline < 30 days:

'Only show if'

'deadline' column

'bigger than'

[Today]

and

'Only show if'

'deadline' column

'smaller than'

[Today]+30

View 3, named: Deadline > 30 days:

'Only show if'

'deadline' column

'bigger than'

[Today]+30

Additionally I placed the different webparts in colored tables (red, orange and green).In this way it’s very easy for me to prioritize the different tasks in my task list. .

0

The formula to add for only the date is =TEXT(TODAY(),"mm/dd/yyyy"). Make sure the outcome is a single line text.

1
  • 2
    The question is how to get date and time, not only date.. Commented Dec 9, 2015 at 10:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.