Friday 2 March 2018

How to change date format from "MM/DD/YYYY" (US) to "DD/MM/YYYY" (UK) in SharePoint?

Scenario:
As clients reside in different countries, we need to change date format as per their current use. Recently I was given task to change date format from "MM/DD/YYYY" (US) to "DD/MM/YYYY" (UK).

Note:
Generally my blog contains warning after solution. But as this one affects wide range of settings, I would prefer that you first get approval for this.

Solution:

So the simplest way to achieve this is to change regional settings and SharePoint automatically change the date format accordingly. As I have told in note section, this will change each and every date in system to selected region format. So please get approval first. It may affect other settings too. But I am still not fully got aware where else this can affect.

So follow below steps to change regional settings:


  • Log into your SharePoint Site as the Site Administrator
  • Click Site Actions then Site Settings

  • From the Site Administration section click Regional Settings

  • Select English (United Kingdom) from the Locale: drop down box.

  • Click OK.


Thursday 1 March 2018

Merge two column values using calculated column in SharePoint

Scenario:

I continuously work in SharePoint and get some experience. Today I got a task to get value of two columns and concatenate it and store it in third column. So I know I can do that using calculated column. I have heard about it. Didn't you? but how exactly it works?

Solution:

So I have google on calculated column and what I found was a hidden treasure. You can get it too by clicking reference link. Microsoft has documented each type of scenario on there. But as my part was only for concatenation of two string, I have used "&" operator in between two columns and it worked great. I have put option related my scenario below:

Column1 Column2 Formula Description (possible result)
Love Thakker =[Column1]&[Column2] Combines the two strings (LoveThakker)
Love Thakker =[Column1]&" "&[Column2] Combines the two strings, separated by a space (Love Thakker)
Love Thakker =[Column2]&", "&[Column1] Combines the two strings, separated by a comma and a space (Love, Thakker)
Love Thakker =CONCATENATE([Column2], ",", [Column1]) Combines the two strings, separated by a comma (Love,Thakker)


Reference:

As I mentioned earlier, you can go on below link and check other scenarios as well:

HTML Print Page functionality

Scenario:

We are getting some simpler task some days and we learn new things about technology or language which is always there, but we are never aware of it. We use it sometimes too but unaware how it is working until you need to develop it.

So we have a simple request that client wants print functionality in page. No big deal. JavaScript provides such functionality with simple command "window.print();". Just use below code and you are good to go:

Code:

<button onclick="window.print();">Print this page</button>


Note:

All browsers use their own way of printing. So the user experience will be different.

Reference:

https://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_print