DATE$ formats

Discussions related to the extensions to the language available in LBB
guest
Site Admin
Posts: 197
Joined: Tue Apr 03, 2018 1:34 pm

DATE$ formats

Post by guest »

(copied from the old forum)

In LB4 DATE$ provides only three formats for returning the date as a string:

Code: Select all

  print date$("mm/dd/yyyy") ' 01/30/2012
  print date$("mm/dd/yy")   ' 01/30/12
  print date$("yyyy/mm/dd") ' 2012/01/30
LBB is more flexible, it will return the date in any format that can be constructed from the following elements, in any order, separated by '/' or '-':

d     Day of month as digits with no leading zero for single-digit days.
dd    Day of month as digits with leading zero for single-digit days.
ddd   Day of week as a three-letter abbreviation.
dddd  Day of week as its full name.
m     Month as digits with no leading zero for single-digit months.
mm    Month as digits with leading zero for single-digit months.
mmm   Month as a three-letter abbreviation.
mmmm  Month as its full name.
y     Year as last two digits, but with no leading zero for years less than 10.
yy    Year as last two digits, but with leading zero for years less than 10.
yyyy  Year represented by full four digits.

So for example:

Code: Select all

print date$("dddd dd-mmmm-yyyy") ' Sunday 30-January-2012
Richard.