Calculated Field and Date Time Field


Badge +11

I have a calculated field that in SharePoint 2013 that is set to a date time format formatted to only display date. I have a date time field only to display date. How do I take the values in the calculated field and copy them to the date time field using the 2013 workflow?


15 replies

Userlevel 5
Badge +12

Hi Lisa,

You could save the calculated field to a backing text field column and then update the date column via the workflow.   There isn't an out of the box way that I know of to connect the calculated field directly to a date column, although I wish there were!

-Mike

Badge +17

Lisa,

Saw this and wanted to know what are you attempting to achieve? I thought you had the dates in the corrected format from the last question. 

What is the end result and maybe we can work towards that.

Badge +11

I got the calculated field set up as you said. However, I already have date fields that need to be populated and that users will continue to populate manually. So I thought taking those calculated field values and moving them over would achieve that.

Badge +11

I was getting error messages simply copying the calculated field values. Its crazy. It shouldn't be this hard. I should just be able to update these dates.

Badge +17

Can you share what your list and workflow look like? In your workflow you could bring in the calculated date as a variable setup as a date.  You should then be able to set item or update item and set the field to the variable.  Is that not working?

Badge +11

Here ya go!

DateWorkflow.jpg

Badge +11

I changed this workflow when I couldn't get the date to work. I have it so it is pulling a text field from the source that has dates in it and putting it in a text field in the target. I figured then I could in SharePoint change the target text field manually to a date. But it kept throwing errors when I would try to update.

Badge +11

I think part of the problem is there are some dates that have an extra space after the month.

Badge +17

Its got to be something simple that is causing an issue. What does your list look like?

Userlevel 5
Badge +12

Date field does tend to be very picky as to what it'll accept as a valid value.  Do you have the SP list date field set to display just Date or both Date and Time? 

Badge +11

Ok, I found the issue. Of course, I found it by accident. It was the data. For any date that was a single digit date there were two spaces in between the date and the month. For example, Nov 5 2016 was Nov  5 2016. Nov 15 2016 would be correct. So when the workflow would try to convert this, it would cause an error. I never caught it because the very first date was a single digit date!!! That immediately threw an error. So instead of wasting time, I just copied the items in a spreadsheet and scrolled through and tried to find the single digit dates and fix them. It wasn't terribly bad. Then I just copied and pasted them in the Quick Edit View in SharePoint 100 at a time. Before doing it I changed it to text field. When I finished I changed it to date/time not displaying the time. It worked like a charm!

Badge +11

It sure was!!!! I hate when that happens! An Excel macro populated the source list which messed the data up.

Badge +11

I don't know which answer to mark as correct. Mike did point me in the direction about how picky the convert function was and how it wouldn't accept just any data.

Badge +17

I would mark your revelation of the issue as correct so people know to check the data as well :-). 

Badge +11

Thanks Eric Harris​ and Mike M​ for helping me on this! I want to be sure to give you some credit by directly using your name (Mention) so you can get some points as well.

Reply