DateTime dateTime = DateTime.Now; string date = dateTime.ToString("yyyy-MM-dd"); string time = dateTime.ToString("HH:mm:ss");