VerityDotNet 1.0
C# library for Verity data profiling, quality control, remediation
|
Various functions to manipulate datetime. More...
Static Public Member Functions | |
static List< int > | GetCurrentISODateAsList (Boolean inctime=false, string tz="", double offDays=0, double offHrs=0, double offMins=0) |
Get current date or datetime in ISO format separated in a list of integers with indexing: 0=year, 1=month, 2=day and if time included: 3=hours, 4=minutes, 5=seconds. | |
static string | GetCurrentISODateTime (Boolean inctime=false, string tz="", double offDays=0, double offHrs=0, double offMins=0) |
Get current date or datetime in ISO format but without delimiters like 20240409 or 20240409T090245. | |
static string | IsISODateStr (string datein, bool timereq) |
Determines if string is in ISO8601 date format. | |
static bool | IsYearLeap (int nyear) |
Determines is year is a leap year. Uses rule that every 4th year is leap except when multiple of 100, but when multiple of 400 it is leap. | |
static string | ConvertExcelDateToISO (string excelDateString) |
Excel numeric date to ISO format. Converts a date in numeric excel format into ISO8601 yyyyMMdd format. Fractional days are removed.Jan 1 1900 is 1. Anything less than 1 is error. Example: 44106 = 20201002, 45393 = 20240411, 21012=19570711. | |
static string | ConvertDateToIso (string datein, string formatin, Boolean detectFormat) |
Converts a datetime into ISO8601 format based on specified format. Time portions should be removed prior to sending into this method. Four delimiters in date part will be automatically detected: ( - / _ . ) | |
static bool | IsDateFormat (string datein, string formatin) |
Determines if date string is in specified format Time portions should be removed prior to sending into this method. Four delimiters in date part will be automatically detected: ( - / _ . ) | |
Various functions to manipulate datetime.
|
static |
Converts a datetime into ISO8601 format based on specified format. Time portions should be removed prior to sending into this method. Four delimiters in date part will be automatically detected: ( - / _ . )
datein | incoming date string not in ISO8601 and without time part |
formatin | required unless detectfmt is True mmddyy, mmdyy, mdyy, mmddyyyy, mmdyyyy, mdyyyy, ddmmyy, ddmyy, dmyy, ddmmyyyy, ddmyyyy, dmyyyy, yymmdd, yymmd, yymd, yyyymmdd, yyyymmd, yyyymd, yyyyddd(3 digit day number within year), yyyyMMMdd, ddMMMyyyy(MMM = 3 letter month title like 'JAN'), 'MONTHdd,yyyy', 'ddMONTH,yyyy', yyyyMONTHdd, ddMONTHyyyy, yyMONTHdd, ddMONTHyy(MONTH full title), dmmyyyy, mm dyyyy, mddyyyy, dd myyyy(*= can be 1 or 2 characters) With these formats, incoming string must have all characters required so for mmddyyyy there must be 8 characters meaning 1122011 fails but 01122011 is good. Leading title of day is removed like for Wednesday, March 14, 2001 which will be changed to March 14, 2001 and then will match formatin of MONTHdd,yyyy since spaces are removed |
detectFormat | optional bool when True the format will be detected if possible. To do so, the date part should have a delimiter( / - ) like 12/20/2021 or 2024-04-02, and preferably where day value is unambiguous relative to month(i.e. > 12 ) |
|
static |
Excel numeric date to ISO format. Converts a date in numeric excel format into ISO8601 yyyyMMdd format. Fractional days are removed.Jan 1 1900 is 1. Anything less than 1 is error. Example: 44106 = 20201002, 45393 = 20240411, 21012=19570711.
excelDateString | initial string |
|
static |
Get current date or datetime in ISO format separated in a list of integers with indexing: 0=year, 1=month, 2=day and if time included: 3=hours, 4=minutes, 5=seconds.
inctime | bool to include time part which comes with T prefix |
tz | optional time zone offset hours as string. If empty, then ignored and local computer server setting used. From UTC (e.g. Dallas TX is -5, Kolkata India is +5.5, New York NY is -4) |
offDays | optional number of days to offset |
offHrs | optional number of hours to offset |
offMins | optional number of mins to offset |
|
static |
Get current date or datetime in ISO format but without delimiters like 20240409 or 20240409T090245.
inctime | bool to include time part which comes with T prefix |
tz | optional time zone offset hours as string. If empty, then ignored and local computer server setting used. From UTC (e.g. Dallas TX is -5, Kolkata India is +5.5, New York NY is -4) |
offDays | optional number of days to offset |
offHrs | optional number of hours to offset |
offMins | optional number of mins to offset |
|
static |
Determines if date string is in specified format Time portions should be removed prior to sending into this method. Four delimiters in date part will be automatically detected: ( - / _ . )
datein | incoming date string not in ISO8601 and without time part |
formatin | required mmddyy, mmdyy, mdyy, mmddyyyy, mmdyyyy, mdyyyy, ddmmyy, ddmyy, dmyy, ddmmyyyy, ddmyyyy, dmyyyy, yymmdd, yymmd, yymd, yyyymmdd, yyyymmd, yyyymd, yyyyddd(3 digit day number within year), yyyyMMMdd, ddMMMyyyy(MMM = 3 letter month title like 'JAN'), 'MONTHdd,yyyy', 'ddMONTH,yyyy', yyyyMONTHdd, ddMONTHyyyy, yyMONTHdd, ddMONTHyy(MONTH full title), dmmyyyy, mm dyyyy, mddyyyy, dd myyyy(*= can be 1 or 2 characters) With these formats, incoming string must have all characters required so for mmddyyyy there must be 8 characters meaning 1122011 fails but 01122011 is good. Leading title of day is removed like for Wednesday, March 14, 2001 which will be changed to March 14, 2001 and then will match formatin of MONTHdd,yyyy since spaces are removed |
|
static |
Determines if string is in ISO8601 date format.
datein | original string date |
timereq | Boolean whether time portion is required Thhmmss.s |
|
static |
Determines is year is a leap year. Uses rule that every 4th year is leap except when multiple of 100, but when multiple of 400 it is leap.
nyear | integer year |