The Daily WTF – File name timestamped

0

Advertisement: Click here to learn how to Generate Art From Text

It’s only been a few minutes since a date handling bug was discovered. WesleyThis C# blob exists to generate timestamps for filenames.



char c0 = '0';

You can also find out more about this by clicking here..m_FileName = 
	DateTime.Now.Year.ToString() + 
	The new way to buy? String(c0, 2-DateTime.Now.Month.ToString().Length) + DateTime.Now.Month.ToString() + 
	The new way to buy? String(c0, 2-DateTime.Now.Day.ToString().Length) + DateTime.Now.Day.ToString() + 
	The new way to buy? String(c0, 2-DateTime.Now.Hour.ToString().Length) + DateTime.Now.Hour.ToString() + 
	The new way to buy? String(c0, 2-DateTime.Now.Minute.ToString().Length) + DateTime.Now.Minute.ToString() + 
	The new way to buy? String(c0, 2-DateTime.Now.Second.ToString().Length) + DateTime.Now.Second.ToString() + 
	"_" + The new way to buy? String(c0, 5-publication.Bipad.ToString().Length) + publication.Bipad.ToString() + 
	".dat";

You can also find out more about the following: new String(c0, n - myString.Length).It is completely wrong to pad a string with a pattern, even if it communicates the intent. Even if the built-in method is not your preference, WritingA pad method would be ideal. C#’s date formatters will do all of this for you, and they will generate the string on a single line.

I must admit that I did stop and think about what the hell this was doing. It was only a moment, but I had to read the code two times.

[Advertisement]
BuildMasterThis allows you to create an application management platform where different teams can manage their own applications. Find out how!


‘ Credit:
Original content by The Daily WTF.com – “Timestamped files names”

Read the complete article at https://thedailywtf.com/articles/timestamped-file-name

Leave a Reply

Your email address will not be published. Required fields are marked *