This handles a lot more than standard formatdate() tkens %yyy%/%hh etc. as well as parsing those dates.
Maybe someone else can find use for it (or better, find bugs, improve, etc)
Windows only, due to timezone & locale parts, but if someone wants to convert that to linux/mac - have at it!
Code: Select all
;- enhDateMOD.pbi
;-
;-------------------------
;---- Enhanced Date ------
;-------------------------
; "enahanced" formatdate()
; Supports the standard formatdate() tokens (%hh, %ii, %mm, etc)
; Additional tokens (case specific, use lower case)
; %m - Month, Single digit, if applicable
; %d - Day, "
; %h - Hour, "
; %i - Minute, "
; %s - Second, "
; %M - Month name: Jan, Feb, Mar, etc.
; %MM - Month name: January, February, March, etc.
; %D - Day of week: Mon, Tue, Wed, etc.
; %DD - Day of week: Monday, Tuesday, Wednesday, etc.
; %Od - "st", "nd" as in 1st, 2nd, for day of month (this is O oh, not 0 zero)
; %Om - same but for month (this is O oh, not 0 zero)
; %ampm - am or pm
; %AMPM - AM or PM
; %ms - milliseconds (when applicable)
; %tzo - TimeZone Offset (ie: -08:00)
; %tzn - TimeZone (ie: PST)
; %tzN - Timezone (ie: Pacific Standard Time)
; %RR - Hour, (double digit) w/o +12 for pm (double digit, ie:09, 10 instead of 22)
; %R - Hour, (single digit) "
; %wn - Week number *
; #LL - Locale long date format (Windows Only) (::parse() attempts to deal with this)
; #LS - locale short date format (Windows Only) (::parse() can't handle this)