Liberty BASIC Help Online

DATE$( )
Instead of adopting the date$ variable from QBasic, Liberty BASIC uses a function instead.  This approach gives some additional flexibility.  Unless otherwise indicated, the function returns today's date in the format specified.  See also TIME$( )Date and Time Functions
  'This form of date$()       produces this format
  print date$()             ' Nov 30, 1999
  print date$("mm/dd/yyyy") ' 11/30/1999
  print date$("mm/dd/yy")   ' 11/30/99
  print date$("yyyy/mm/dd") ' 1999/11/30    for sorting
  print date$("days")       ' 36127         days since Jan 1, 1901
  print date$("4/1/2002")   ' 36980         days since Jan 1, 1901 for given date
  print date$(36980)        ' 04/01/2002    mm/dd/yyyy string returned
                            '               when given days since Jan 1, 1901
You can assign a variable to the result:
  d$ = date$( )
NOTE:  All the above forms return a string except for date$("days"), and date$("4/1/02")
Using the date$("4/1/02") function:
This function returns the number of days since Jan 1, 1901 for the given date.  Any of the following formats are acceptable.  Please notice that if the first two digits of the year are omitted, 20xx is assumed.
  'some examples
  print date$("4/1/02")                   'this assumes 4/1/2002
  print date$("1/1/1901")
  print date$("April 1, 2002")
  print date$("Apr 1, 2002")
Here is a small program that demonstrates the last two implementations of the date$ function.  It determines the number of shopping days until the holiday season:
  today = date$("days")
  target = date$("12/25/2003")  'subsititute current year and desired holiday
  print "Shopping days left:  ";
  print target - today

Copyright (C) 2003 Shoptalk Systems
Liberty BASIC -