CinderellaMGS.SQL_Queries.getDate C# (CSharp) Method

getDate() public method

Retrieves the current date and time from the database server.
public getDate ( ) : string
return string
        public string getDate()
        {
            DataSet ds = sqlSelect("getDate");
            DataTable dt = ds.Tables["tableName"];

            return dt.Rows[0][0].ToString();
        }

Usage Example

        /// <summary>
        /// Will return the current date and time from the sql server so that you do not have to use the date and time on the client computers.
        /// </summary>
        /// <returns>The current date and time form the sql server.</returns>
        public static string getDate()
        {
            SQL_Queries sqlQuery = new SQL_Queries();
            //return '3/18/2011 3:30:00 PM'; //Shift 1
            //return "3/19/2011 7:01:00 AM"; //Shift 2
            //return '3/19/2011 1:00:00 PM'; //Shift 3

            return sqlQuery.getDate();
        }