Click here to Skip to main content
15,886,362 members
Everything / DateTime

DateTime

DateTime

Great Reads

by Christoph Buenger
Describes PHP application development with the free Scavix Web Development Framework (Scavix-WDF).
by Graham Wilson
An exercise to measure the drift in the time-of-day clock on a Windows PC using the periodic timer
by #realJSOP
Find the date of a specified federal holiday for a given year.
by OriginalGriff
Strangely, the .NET DateTime does not provide a Week Number. This extension rectifies this.

Latest Articles

by
An extension library to simplify dealing with .NET's DateTime, DateOnly, TimeOnly and TimeSpan objects, also includes support for the ISO 8601 EDTF profile.
by DiponRoy
Split date time ranges into days or possibly other ranges using CTE in SQL Server
by Bohdan Stupak
Explanation of how DateTime.TryParse behaves with ISO-8601 format
by stc.reseller
Helpful tips in labeling Office files or how to make Office file changes statistically visible, in one single step

All Articles

Sort by Score

DateTime 

1 Feb 2017 by #realJSOP
Find the date of a specified federal holiday for a given year.
14 Jul 2011 by OriginalGriff
Strangely, the .NET DateTime does not provide a Week Number. This extension rectifies this.
10 Nov 2011 by #realJSOP
How about this?public static class ExtendDateTime{ public int CountWeekDays(this DateTime thisdate, DateTime thatDate) { int days = Math.Abs((thisDate - thatDate).Days) + 1; return = ((days/7) * 5) + (days % 7); }}Usage would be like this:DateTime...
6 Dec 2012 by xibao
Code to produce holidays for NYC Stock Exchange.
17 Jan 2011 by KevinAG
Your statement of, "I wanted to validate text inputed by a user as they were typing to tell them if it was a valid date." seems to be a bit misleading. I was under the impression that your code would start off returning true until I entered a non-number character, invalid separator, or invalid...
2 Oct 2011 by Gary Bilkus
How to get Silverlight 4 to display dates by default using the regional settings in the Control Panel.
14 Oct 2010 by InActive
How to use the .NET DateTime class in C++ to generate a basic calendar via a console program
6 Sep 2011 by Bib34770
What about that :CultureInfo.CurrentCulture.Calendar.GetWeekOfYear(pd_date, CalendarWeekRule.FirstFourDayWeek, DayOfWeek.Monday);
8 Sep 2011 by Jani Giannoudis
Here another approach taken from my article Time Period Library for .NET[^], which returns addditional the year of the week.// ------------------------------------------------------------------------public enum YearWeekType{ Calendar, Iso8601,} // enum YearWeekType //...
25 Dec 2011 by Dhol Gaurav
Problem and solution of add date into JavaScript with daylightsaving in different time zone
7 Apr 2012 by Gustav Brock
This is an alternative to using LINQ for "Find the count of a weekday between two dates without iterating/looping".
5 Aug 2014 by maxcellent
Java date generation with Lamma date library (1)
28 Feb 2016 by Er. Puneet Goel
When you are dealing with Date&Time input from user, it's always complicated to handle the Date&Time format. You are not sure about how you will handle the user input format. So, here is the solution.
28 Mar 2011 by Jani Giannoudis
Show a TimeSpan by calendar periods
28 Sep 2011 by musicm122
Datejs could be a possible alternate helper, or if you are going the way of jQuery, check out jQuery validation engine.
6 Oct 2011 by Go Cova
public static int GetFullWorkingDaysBetween(DateTime firstDate, DateTime lastDate, IEnumerable holidays){ if (firstDate > lastDate)// Swap the dates if firstDate > lastDate { DateTime tempDate = firstDate; firstDate = lastDate; lastDate =...
11 Nov 2011 by George Swan
Is it easier to start from the next targeted day? Subtract that date from the end date. If the result is negative, return 0 otherwise return the quotient of the difference in days between the two dates divided by 7 plus 1.public static int findWeekCount(DateTime startDate, DateTime toDate,...
17 Nov 2011 by rld1971
I like things simple for debugging purposes... LINQ implies a list or some iterable thing, but that's just me. I think this works:static int CountDayOcurrence(DateTime start, DateTime end, DayOfWeek day){ var wstart = start.AddDays(7 - (int) start.DayOfWeek); // Sunday after start...
23 Nov 2011 by K Quinn
Didn't read it very closely, haven't tested it very thoroughly, but, you get the idea:public int GetNumberOfRecurrances(DayOfWeek weekDay, DateTime startDate, DateTime endDate){ int distanceToFirstInstance = ((int)weekDay - ((int)startDate.DayOfWeek)); //determine integer...
10 Aug 2014 by maxcellent
This article discusses basic date sequence generation with Lamma date library in Java
7 Jul 2015 by Pavel Durov
Tip about converting .NET DateTime to Unix double timestamp and vise versa - on .NET
29 Nov 2012 by Ed Nutting
JavaScript Date Validation
5 Jun 2011 by thatraja
Display Date Time in 12/24 hour time format in C#/VB.NET
25 Dec 2011 by Ravi LVS
Find the count of a weekday between two dates without iterating/looping
25 Mar 2010 by R. Giskard Reventlov
When using DateTime with SQL Server, I often forget what the parameters are that allow formatting DateTime in specific ways. When that happens, I fire up this code fragment in SQL Server Management Studio and it neatly lists out every possible parameter with example output.declare @Loop...
8 May 2021 by Bohdan Stupak
Explanation of how DateTime.TryParse behaves with ISO-8601 format
17 Dec 2012 by middelpat
Adding and subtracting with dates and times ignoring weekends
24 Apr 2016 by Emmanouil Gimissis MSc ICSD
Fast calculation of week days between two dates using DateDiff
30 Nov 2016 by Dudyalu Sravan Kumar Reddy
In this tip, we will learn about using DateTime picker in ASP.NET Core using JQuery Plugin. Let’s start with a step by step approach.
27 Mar 2012 by SA - Hibbert
Return all records between two dates that include time in SQL.
25 Mar 2011 by Jani Giannoudis
Calculate the number of whole working days between start and end with support of holidays and holiday-periods.
27 Feb 2014 by Charan_Kumar
Splitting dates of different months in Asp.Net
14 Oct 2014 by Jamie Highfield
WinForms .NET Time Chooser grid control.
21 Jan 2015 by Bhis
Read XML File and change date contents
16 Nov 2017 by Suvendu Shekhar Giri
Difference between MySQL DATETIME and TIMESTAMP datatypes
9 Dec 2009 by Mark Graham
When searching between datetimes in SQL(or SQL in a Stored Proc) we can't just do:select * from where CreateTime >= @DateFrom and CreateTime
9 Oct 2015 by Hamid Mosalla
PersianCalendarPlus is a simple wrapper around System.Globalization.PersianCalendar. In this tip, I'm going to show you how you can use it.
19 Jul 2011 by Gustav Brock
DateTime Extension method to give the right week number
17 Sep 2018 by Jason Sobell
The manipulation of dates in an application is not as straightforward as it first appears, but some simple understanding of the way Dates apply to real-world usage can help avoid all sorts of nasty issues down the line.
18 Dec 2015 by dynamichael
Use extension methods, Encoding, and BitConverter to read and write native types on an IO.Stream object
12 Dec 2012 by Pranay Rana
Convert DateTime string to DateTime variable
11 Nov 2011 by Prerak Patel
Single line in Linq This gets you the number of weekdays, i.e., Monday to Friday between given two dates.[VB]Dim dt1 As New Date(2011, 1, 1)Dim dt2 As New Date(2011, 1, 15)Dim days As Integer = (From d As Date In _ (Enumerable.Range(0, 1 +...
1 Jul 2023 by DiponRoy
Split date time ranges into days or possibly other ranges using CTE in SQL Server