DateUtils utilitary class. More...
Static Public Member Functions | |||||||||
static string | ConvertDateToString (DateTime?date, string pattern) | ||||||||
Converts a date to a string. More... | |||||||||
static DateTime | BuildDate (int?day, int?month, int?year) | ||||||||
Builds a date using the given day, month, and year. More... | |||||||||
static DateTime | BuildDate (string day, string month, string year) | ||||||||
Builds a date using the given day, month, and year. More... | |||||||||
static DateTime | UpdateYear (DateTime?date, int?year) | ||||||||
Updates the year of a date. More... | |||||||||
static DateTime | UpdateYearAndMonth (DateTime?date, int?year, int?month) | ||||||||
Updates the year and month of a date. More... | |||||||||
static DateTime | UpdateYearMonthAndDay (DateTime?date, int?year, int?month, int?day) | ||||||||
Updates the year, month and day of a date.
| |||||||||
static DateTime | AddDaysToCurrentDate (int?days) | ||||||||
Adds a number of days to the current date. More... | |||||||||
static DateTime | AddMonthsToCurrentDate (int?months) | ||||||||
Adds a number of months to the current date. More... | |||||||||
static DateTime | AddYearsToCurrentDate (int?years) | ||||||||
Adds a number of years to the current date. More... | |||||||||
static DateTime | AddDaysToDate (DateTime?date, int?days) | ||||||||
Adds a number of days to a given date. More... | |||||||||
static DateTime | AddMonthsToDate (DateTime?date, int?months) | ||||||||
Adds a number of months to a given date. More... | |||||||||
static DateTime | AddYearsToDate (DateTime?date, int?years) | ||||||||
Adds a number of years to a given date. More... | |||||||||
static int | CompareDates (DateTime?date1, DateTime?date2) | ||||||||
Compares two dates. More... | |||||||||
static int | CompareDatesIgnoringYear (DateTime?date1, DateTime?date2) | ||||||||
Compares two dates ignoring the year. More... | |||||||||
static bool | IsInInterval (DateTime?dateInf, DateTime?dateSup, DateTime?dateToTest) | ||||||||
Checks if a date is within a time interval. More... | |||||||||
static int | GetDifferenceInDays (DateTime?date1, DateTime?date2) | ||||||||
Computes the number of days between two dates. More... | |||||||||
static int | GetDifferenceInYears (DateTime?date1, DateTime?date2) | ||||||||
Computes the number of years between two dates.
| |||||||||
static int | GetDifferenceInWorkingDays (DateTime?date1, DateTime?date2) | ||||||||
Computes the number of working days between two dates. More... | |||||||||
static int | GetYear (DateTime?date) | ||||||||
Retrieves the year of a date. More... | |||||||||
static string | GetYearAsString (DateTime?date) | ||||||||
Retrieves the year of a date as a string. More... | |||||||||
static int | GetMonth (DateTime?date) | ||||||||
Retrieves the month of a date. More... | |||||||||
static string | GetMonthAsString (DateTime?date) | ||||||||
Retrieves the month of a date as a string. More... | |||||||||
static int | GetDay (DateTime?date) | ||||||||
Retrieves the day of the month of a date. More... | |||||||||
static string | GetDayAsString (DateTime?date) | ||||||||
Retrieves the day of the month of a date as a string. More... | |||||||||
static DateTime | ConvertStringToDate (string sDate) | ||||||||
Converts a string to a date. Supported formats : "ddMMyy", "dd/MM/yyyy", "ddMMyyyy", "dd/MM/yy" and "dd-MM-yyyy". More... | |||||||||
static DateTime | ConvertStringToDate (string sDate, string format) | ||||||||
Convert a string to a date using specified format. More... | |||||||||
Public Attributes | |
const long | MILLISECOND_PER_DAY = 24 * 60 * 60 * 1000 |
Number of millisenconds in a day. More... | |
const long | MILLISECOND_PER_YEAR = MILLISECOND_PER_DAY * 365 |
Number of millisenconds in a year. More... | |
const string | SHORT_DATE_FORMAT = "ddMMyy" |
Short date format ("ddMMyy"). More... | |
const string | STANDARD_DATE_FORMAT = "dd/MM/yyyy" |
Standard date format ("dd/MM/yyyy") More... | |
const string | STANDARD_DATE_FORMAT_WITHOUT_SEP = "ddMMyyyy" |
Standard date format, without separators ("ddMMyyyy") More... | |
const string | SHORT_DATE_FORMAT_WITH_SEP = "dd/MM/yy" |
Short date format, with separators ("ddMMyy") More... | |
Static Public Attributes | |
static readonly string | STANDARD_DATE_FORMAT_WITH_TIRET = "dd-MM-yyyy" |
Standard date format with dashes ("dd-MM-yyyy") More... | |
Detailed Description
DateUtils utilitary class.
Member Function Documentation
|
static |
Adds a number of days to the current date.
- Parameters
-
days The number of days to add.
- Returns
- A new date, built by adding days days to the current date.
|
static |
Adds a number of days to a given date.
- Parameters
-
date The date to modify. days The number of days to add.
- Returns
- A new date, built by adding days days to the date .
|
static |
Adds a number of months to the current date.
- Parameters
-
months The number of months to add.
- Returns
- A new date, built by adding months months to the current date.
|
static |
Adds a number of months to a given date.
- Parameters
-
date The date to modify. months The number of months to add.
- Returns
- A new date, built by adding months months to the date .
|
static |
Adds a number of years to the current date.
- Parameters
-
years The number of years to add.
- Returns
- A new date, built by adding years years to the current date.
|
static |
Adds a number of years to a given date.
- Parameters
-
date The date to modify. years The number of years to add.
- Returns
- A new date, built by adding years years to the date .
|
static |
Builds a date using the given day, month, and year.
- Parameters
-
day The day of the month. month The month. year The year.
- Returns
- A new instance of DateTime.
|
static |
Builds a date using the given day, month, and year.
- Parameters
-
day The day of the month. month The month. year The year.
- Returns
- A new instance of DateTime.
|
static |
Compares two dates.
- Parameters
-
date1 The first date to compare. date2 The second date to compare.
- Returns
- 1 if the first date is later than the second date. -1 If the first date is anterior to the second date, 0 if the two dates are identical (to the day).
|
static |
Compares two dates ignoring the year.
- Parameters
-
date1 The first date to compare. date2 The second date to compare.
- Returns
- -1 If the first date is anterior to the second date, 0 if the two dates are identical (to the day).
|
static |
Converts a date to a string.
- Parameters
-
date The date to convert. pattern The date pattern used to parse the date.
- Returns
- String representation of given date.
|
static |
Converts a string to a date. Supported formats : "ddMMyy", "dd/MM/yyyy", "ddMMyyyy", "dd/MM/yy" and "dd-MM-yyyy".
- Parameters
-
sDate A string reprensenting a date.
- Returns
- The date extracted from sDate .
|
static |
Convert a string to a date using specified format.
- Parameters
-
sDate A string reprensenting a date. format The format to parse the date.
- Returns
- The date extracted from sDate .
|
static |
Retrieves the day of the month of a date.
- Parameters
-
date A date
- Returns
- The day of the month of given date.
|
static |
Retrieves the day of the month of a date as a string.
- Parameters
-
date A date
- Returns
- The string representation of the day of the month of given date.
|
static |
Computes the number of days between two dates.
- Parameters
-
date1 The first date. date2 The second date.
- Returns
- Rounded difference number of days between date2 and date1. Positive if date2>date1, otherwise negative.
|
static |
Computes the number of working days between two dates.
- Parameters
-
date1 The first date. date2 The second date.
- Returns
- Rounded difference number of working days between date2 and date1. Positive if date2>date1, otherwise negative.
|
static |
Computes the number of years between two dates.
- Parameters
-
date1 The first date. date2 The second date.
- Returns
- Rounded difference number of years between date2 and date1. Positive if date2>date1, otherwise negative.
|
static |
Retrieves the month of a date.
- Parameters
-
date A date
- Returns
- The month of given date.
|
static |
Retrieves the month of a date as a string.
- Parameters
-
date A date
- Returns
- The string representation of the month of given date.
|
static |
Retrieves the year of a date.
- Parameters
-
date A date
- Returns
- The year of given date.
|
static |
Retrieves the year of a date as a string.
- Parameters
-
date A date
- Returns
- The string representation of the year of given date.
|
static |
Checks if a date is within a time interval.
- Parameters
-
dateInf The inferior limit of the time interval. dateSup The superior limit of the time interval. dateToTest The date to check.
- Returns
- true if dateToTest is included between dateInf and dateSup .
|
static |
Updates the year of a date.
- Parameters
-
date The date to update. year The new year.
- Returns
- A new date, with updated year value.
|
static |
Updates the year and month of a date.
- Parameters
-
date The date to update. year The new year. month The new month.
- Returns
- A new date, with updated year and month values.
|
static |
Updates the year, month and day of a date.
- Parameters
-
date The date to update. year The new year. month The new month. day The new day
- Returns
- A new date, with updated year, month and days values.
Member Data Documentation
const long Summer.Batch.Extra.Utils.DateUtils.MILLISECOND_PER_DAY = 24 * 60 * 60 * 1000 |
Number of millisenconds in a day.
const long Summer.Batch.Extra.Utils.DateUtils.MILLISECOND_PER_YEAR = MILLISECOND_PER_DAY * 365 |
Number of millisenconds in a year.
const string Summer.Batch.Extra.Utils.DateUtils.SHORT_DATE_FORMAT = "ddMMyy" |
Short date format ("ddMMyy").
const string Summer.Batch.Extra.Utils.DateUtils.SHORT_DATE_FORMAT_WITH_SEP = "dd/MM/yy" |
Short date format, with separators ("ddMMyy")
const string Summer.Batch.Extra.Utils.DateUtils.STANDARD_DATE_FORMAT = "dd/MM/yyyy" |
Standard date format ("dd/MM/yyyy")
|
static |
Standard date format with dashes ("dd-MM-yyyy")
const string Summer.Batch.Extra.Utils.DateUtils.STANDARD_DATE_FORMAT_WITHOUT_SEP = "ddMMyyyy" |
Standard date format, without separators ("ddMMyyyy")
The documentation for this class was generated from the following file:
- Summer.Batch.Extra/Utils/DateUtils.cs