Hello, (didn't want this to get buried because the other thread was marked with a Solution")
I really need help determining the difference between two times. This is quite a challenging undertaking!
Two Date+Time cards:
Code (get your wading boots on!):
//Concatenate the diffed Hours, ":" and diffed Minutes//
Concatenate(
//Convert the diffed Hours and Minutes to Text//
Text(
//Perform DateDiff to determine difference between Hours//
DateDiff(
//Use DateTimeValue to format the text string to Hours//
DateTimeValue(
//Get start date, hour and minutes into a format that DateTimeValue likes. Note the Char(13)! (clever)//
Concatenate( Text( startDate.SelectedDate,DateTimeFormat.ShortDate), Char(13), Text( Concatenate( startHour.Selected.Value, ":", startMinute.Selected.Value),ShortTime)),"en-US"), DateTimeValue(
//Get end date, hours and minutes into a format that DateTimeValue likes.
Concatenate( Text( endDate.SelectedDate,DateTimeFormat.ShortDate), Char(13), Text( Concatenate( endHour.Selected.Value, ":", endMinute.Selected.Value),ShortTime)),"en-US"), Hours),"[$-en-US]##"), ":",
//Do the same thing for Minutes//
Text( DateDiff( DateTimeValue( Concatenate( Text( startDate.SelectedDate,DateTimeFormat.ShortDate), Char(13), Text( Concatenate( startHour.Selected.Value, ":", startMinute.Selected.Value),ShortTime)),"en-US"), DateTimeValue( Concatenate( Text( endDate.SelectedDate,DateTimeFormat.ShortDate), Char(13), Text( Concatenate( endHour.Selected.Value, ":", endMinute.Selected.Value),ShortTime)),"en-US"), Minutes),"[$-en-US]##") )
But this results in:
How do I get the correct times to display?
Thanks
Solved! Go to Solution.
I'm hoping you can give me some suggestions for this. I've been struggling all day. I used your most recent sample (which is great to have), and I applied to my test, and I can't get it to work. I've added a screenshot of my test and the code I'm using below. The only difference is that my fields reside in datacards. Is that the problem? I need to save the times submitted (as well as the calculation) back to SharePoint. Any advice you can provide is appreciated.