locked
How to do a date calculation? RRS feed

  • Question

  • SharePoint 2007 :

    I have a list with 2 custom columns (Creator, Checker) that contains name, date & time they respond and a third column (Duration) that is calculated field, as below:

    1) Creator - domain\ledasaa 12/04/2011 12:05 --> text format

    2) Checker - domain\ledasaa 13/04/2011 12:05 --> text format

    3) Duration --> number format

    I wanted to calculate the difference between the first 2 columns and show it in the  3rd field.

    So what is the calculation? because this 2 field is text format? Please assits.. Thanks in advance




    • Moved by Clayton Cobb Wednesday, April 13, 2011 4:59 AM 2007 question (From:SharePoint 2010 - Using SharePoint Designer, Infopath, and other customization)
    • Edited by Mike Walsh FIN Wednesday, April 13, 2011 5:41 AM SharePoint 2007 : moved from title to text (default here also don not use prefixes in titles)
    Wednesday, April 13, 2011 2:51 AM

Answers

  • This is the 2010 forum.  Pre-2010 questions go in pre-2010 forums.

    You can't do a calculation with an alphanumeric string like that.  You need to strip out the actual date portion and use a formula to subtract days (i.e. DateDiff).  You can do this with other calculated fields that use Search/Left/Right Excel functions to basically substring the date portion into new fields and then set your DateDiff formula in Duration and point it to the intermediate calculated fields.

    How is that wierd string of data getting into Creator and Checker?


    SharePoint Architect || Microsoft MVP || My Blog
    Planet Technologies || SharePoint Task Force
    • Marked as answer by Peng Lei Tuesday, April 19, 2011 8:28 AM
    Wednesday, April 13, 2011 4:59 AM