none
c# - how to get a (specific) format from DateTime.Now RRS feed

Answers

  • cmd.Parameters.Add("@Date", SqlDbType.VarChar);              
    
    cmd.Parameters["@Date"].Value = Convert.ToString(DateTime.Now.ToLongDateString() +" | "+ DateTime.Now.ToLongTimeString());/
    That worked for me :)
    • Marked as answer by Hassaan Raza Monday, June 11, 2018 1:17 AM
    Monday, June 11, 2018 1:16 AM

All replies

  • https://www.dotnetperls.com/datetime-format

    The best you could do is covert the datatime  to a string format.

    You can then use the substring() statement to manipulate the sting into the format you wanted.

    Sunday, June 10, 2018 10:01 PM
  • Look at DateTime Structure. There is a DateTime.ToString Method. If you don't understand how to do something specific about creating a relevant format string then you are much more likely to get help with that.



    Sam Hobbs
    SimpleSamples.Info

    Sunday, June 10, 2018 11:52 PM
  • cmd.Parameters.Add("@Date", SqlDbType.VarChar);              
    
    cmd.Parameters["@Date"].Value = Convert.ToString(DateTime.Now.ToLongDateString() +" | "+ DateTime.Now.ToLongTimeString());/
    That worked for me :)
    • Marked as answer by Hassaan Raza Monday, June 11, 2018 1:17 AM
    Monday, June 11, 2018 1:16 AM