crackyourinterview.com


To improves our performance please Like Share Subscribe(Will boost us)

Create File with Name by adding datetime to it?
Question Posted on 07 Sep 2020Home >> DotNet >> C# >> Create File with Name by adding datetime to it?

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.


File Create in C#
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
0
0



.


Most Visited Questions:-

Deep Learning Questions Answers
Below are the different Deep Leaning Questions and answer a More...

Continuous Integration Questions Answers
Below are the 20 odd questions for CI or Continuous Integra More...

Derived relationships in Association Rule Mining are represented in the form of __________.
Derived relationships in Association Rule Mining are repres More...

What is Gulpjs and some multiple choice questions on Gulp
Gulpjs is an open source whihc helps in building Javascript More...

Microservices Architecture Questions Answers
Below are the different questions on Microservices Architec More...




Other Important Questions

Simplest definition of partial classes and its rules?

Definition of Tuple class with some examples?

Define Race Condition in cSharp?

C#.Net Reserve Words

can we inherit private class level variables in c#






@2014-2022 Crackyourinterview (All rights reserved)
Privacy Policy - Disclaimer - Sitemap