This project has moved. For the latest updates, please go here.

Format Date in SPServices.SPDisplayRelatedInfo

Apr 6, 2011 at 11:05 PM


I have two dates in my form that get displayed when using SPDisplayRelatedInfo and they get shown as "2011-03-25 00:00:00", which I'm not a fan of. The column name is called "WorkPlacementStart"

I'm not that confident in jQuery and have seen there are many date functions around but I can't find one that is suitable.

Can someone give me a hand to get the date into the format of dd/mm/yyyy? I'm guessing that this will go into the completefunc section but am not sure....

Thanks a lot.

p.s. this library is damn amazing, I'm using it so much, thanks for putting it together Marc.

Kevin (@23_kev)

Apr 7, 2011 at 2:20 AM

Glad you're having fun! The formatting you want to do will be with plain old JavaScript. Here's a page with some great examples:

If you look at the output of SPShowRelatedInfo, you'll see that I give elements ids for easy selection. You can grab the value, reformat it, and replace the value with your formatted one. Check the docs for specifics about the ids.