This question already has answers here:
Datetime in C# add days
(7 answers)
Closed 3 years ago.
Hello friends I had a question
For example today
06/24/2019. What code should I use if I want to find the date of the next 20 days?
var d = DateTime.Now().AddDays(20);
Related
This question already has answers here:
Can you round a .NET TimeSpan object?
(10 answers)
Closed 6 years ago.
Round timespan seconds I also need do same with .Hours and .Minutes
This:
1.53994 second
to:
1 second
This code worked for me.
TimeSpan ts = TimeSpan.FromSeconds(1.54);
Math.Round(ts.TotalSeconds);
This question already has answers here:
Getting Date or Time only from a DateTime Object
(7 answers)
Closed 8 years ago.
I know that, Example: DateTime fileCreatedDate = File.GetCreationTime(#"C:\Example\MyTest.txt");will return the date and time of a folder creation but how do I only get the "Date"Example "2014-12-01" or "Decemeber 12,2014" of the folder creation excluding the time?
You can use the DateTime.Date property for that, i.e. fileCreatedDate.Date.
This question already has answers here:
To get the mondays to saturdays in the current month
(3 answers)
Closed 8 years ago.
How do I get the date of all sunday and saturday in a particular year and count the result in C#.
I've searched a lot but only in java gives me result how abut in C#?
I don't know if you already have some code, but you should check DateTime.DayOfWeek.
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Convert String to Date in .NET
I new here, I'm stuck with this problem when a have an array of strings with values of "120612" and "200612".
I need to convert the strings to a date format like this, "Tues 12 June, 2012". How will I do that?
Thanks in advance.
DateTime.ParseExact is probably what you're looking for:
DateTime.ParseExact("200612", "ddMMyy", System.Globalization.CultureInfo.CurrentCulture)
This question already has answers here:
Check last modified date of file in C#
(5 answers)
Closed 9 years ago.
How do I read the modify date of the file in C#?
I can read the creation date of the file by using the code below:
ModifyDate = File.GetCreationTime(FilePath)
File.GetLastWriteTime will do the job
I believe you're looking for GetLastWriteTime