Retiriving Time part from complete date variable RRS feed

  • Question

  • Hi all,

    I have a field of type date, suppose I get value as 11-05-2017T06:44:50.249954.

    How can I only take time part that is 06:44:50.249954 in 24 hrs format and store it in field of type short ?

    I can change type of destination field as it's local schema and can make changes in it if it's not working with short type.

    Thanks and Regards, Nitin.

    Thursday, May 11, 2017 10:14 AM


  • Hi All,

    I got solution for it :

    public string FormatPostingTime(object obj)
                if (obj != null && obj.ToString() != string.Empty)
                    DateTime postingDate = Convert.ToDateTime(obj);
                    return string.Format("{0:HH:mm:ss.fff tt}", postingDate);
                return string.Empty;

    Thanks and Regards, Nitin.

    • Marked as answer by Nitin Surya Thursday, May 11, 2017 11:03 AM
    Thursday, May 11, 2017 11:03 AM