none
Save file with full date only as file name. RRS feed

  • Question

  • Hi All,

    I know I should know this, but I can not get it right. and Googling it only gets me it with Date & Time.

    I want to save a file a day with the full date as file name.

    Ie: Wednesday 02 August 2017.txt

    Can some one please put me out of my frustration and help me.

    Thanks a lot.

    Wednesday, August 2, 2017 12:18 AM

Answers

  • Hi All,

    I know I should know this, but I can not get it right. and Googling it only gets me it with Date & Time.

    I want to save a file a day with the full date as file name.

    Ie: Wednesday 02 August 2017.txt

    Can some one please put me out of my frustration and help me.

    Thanks a lot.

    Hi

    Here is one way. I have set up a variable for 'path' which you would need set to your own requirements, followed by combining it with the filename as requested.

            Dim path As String = My.Computer.FileSystem.SpecialDirectories.Desktop & "\"
            Dim filename As String = Now.Date.ToString("dddd dd MMMM yyyy") & ".txt"
            Dim fullpath As String = IO.Path.Combine(path, filename)
    


    Regards Les, Livingston, Scotland

    • Marked as answer by mikki18 Wednesday, August 2, 2017 12:50 AM
    Wednesday, August 2, 2017 12:33 AM

All replies

  • Hi All,

    I know I should know this, but I can not get it right. and Googling it only gets me it with Date & Time.

    I want to save a file a day with the full date as file name.

    Ie: Wednesday 02 August 2017.txt

    Can some one please put me out of my frustration and help me.

    Thanks a lot.

    Hi

    Here is one way. I have set up a variable for 'path' which you would need set to your own requirements, followed by combining it with the filename as requested.

            Dim path As String = My.Computer.FileSystem.SpecialDirectories.Desktop & "\"
            Dim filename As String = Now.Date.ToString("dddd dd MMMM yyyy") & ".txt"
            Dim fullpath As String = IO.Path.Combine(path, filename)
    


    Regards Les, Livingston, Scotland

    • Marked as answer by mikki18 Wednesday, August 2, 2017 12:50 AM
    Wednesday, August 2, 2017 12:33 AM
  • Thanks Les you saved me once again.
    Wednesday, August 2, 2017 12:50 AM