This method returns the Time and Date of the string given. - CSharp System

CSharp examples for System:DateTime Calculate

Description

This method returns the Time and Date of the string given.

Demo Code


using System.IO;//  w  w  w.jav  a 2s.  c o m
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System;

public class Main{
        #endregion
            
            #region GetShortDateTime(DateTime date)
            /// <summary>
            /// This method returns the Time and Date of the string given.
            /// </summary>
            public static string GetShortDateTime(DateTime date)
            {
                // initial value
                string time = DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString();

                // return value
                return time;
            }
}

Related Tutorials