| Create File with Name by adding datetime to it?
Below code is used to create a file with current datetime now and add file name starts with logs plus the datetime of now.
Now i will explain every line of above code with some example too
(1)"logs-{0:yyyyMMddhhmmsstt}.txt" In this line we have starts with logs which means every file starts with "logs" and then followed by datetime now with seconds too.
(2){0 :- This indicates that this is a string placeholder and "0" indicates the index of the parameters inserted here.
(3)yyyy:- will print full year(2019,2020 etc.)
(4)MM:-prints the month number(02,03,12 etc)
(5)dd:- means day number (1,2,3 etc.)
(6)hh:- Print hours
(7)mm:- print minutes
(8)ss:-print seconds
(9)tt:-print AM or PM | | |