Guys i am unable to convert datetime to \"dd-MMM-yyyy\" format. My code is given below:
TreeNode tn = new TreeNode(dr[\"pBillDate\"].ToString()); // He
The following couple examples should work:
DateTime dt = Convert.ToDateTime(dr["pBillDate"]); TreeNode tn = new TreeNode(String.Format("{0:dd-MMM-yyyy}", dt));
or
DateTime dt = Convert.ToDateTime(dr["pBillDate"]); TreeNode tn = new TreeNode(dt.ToString("dd-MMM-yyyy"));