User:Devon McCormick/DateTime

From J Wiki
Jump to: navigation, search

Here are my personal date and time functions.

The descriptions of the functions and variables in the attached file are as follows:

NB.* moAbbrevs: 3-letter (English) month abbreviations
NB.* baseDPM: base # of days per month (Feb->28)
NB.* weekDayAbbrevs: 3-letter (English) weekday abbreviations
NB.* cvtTS21Num: convert J (or APL) timestamp to YYYYMMDD.(day fraction).
NB.* cvtTmAPMil: convert [h]h:mm[ap] timestamp to hh:mm:00 format.
NB.* calendar: return text calendar for Year-Month YM (in form YYYYMM).
NB.* fmtHMS: format hours, minutes, seconds as string given 3 numbers.
NB.* elapsedTimeMsg: show time elapsed given starting qai=: 6!:1 ''.
NB.* isLaterThan: given timestamp is (1) later than now or not (0).
NB.* DateTimeCvt: Convert between DOS-style time (YYYYMMDD hh:mm[a|p]) & dayfraction.
NB.* DOSTime2DayFrac: DOS date & time MM/DD/YYYY hh:mm[a|p] ->
NB.* monthAdd: add y months to x date YYYYMMDD.
NB.* DateAdd: limited mimic of VB DateAdd - DateAdd <unit to add>;date;num
NB.* waitUntil: wait until time y in [abbreviated] TS form: YYYY MM DD [[hh] [[mm] [[ss]]]]
NB.* adt2sqldt: MS Access date time 'M/D/Y h:m:s'->#M/D/Y#
NB.* yy2yyyy: 2-digit to 4-digit year; <:50 is pivot.
NB.* cvtIfDate2Num: assuming slash means [m]m/[d]d/[yy]yy date, convert to YYYYMMDD.
NB.* calcEOMdates: calculate End-Of-Month dates starting in year 0{y for
NB.* cvtAT: convert vector of timestamps from MSAccess DB to numeric date YYYYMMDD.
NB.* JDCNV: Julian day conversion from
NB.* TSDiff: timestamp difference - return difference between 2 timestamps
NB.* TSAdd: add 2 timestamps - return sum of 2 timestamps
NB.* cvtDateTime2numDt: convert multiple (e.g. MS Access) char date-times, e.g.
NB.* dow: Day-of-week for year month day: 0=Sunday
NB.* toJulian: convert YYYYMMDD date to Julian day number.
NB.* toGregorian: convert Julian day numbers to dates in form YYYYMMDD
NB.* cvtY4M2D22YMD: "2002-06-11" -> 20020611 (numeric)
NB.* cvtMDY2Y4M2D2: convert char [m]m/[d]d/[yy]yy -> yyyymmdd (numeric);
NB.* cvtY4M2D22MDY: convert yyyymmdd (numeric) -> [m]m/[d]d/yyyy (char)