[Search tip detail and code files using keywords, tip number, author name, etc ]
 
    For tip to function correctly, you must ensure that the downloaded file name matches the file name
    displayed in the Rename File To field. Please rename downloaded files when necessary.
Format Dates in LISP Routines
Tip# 4087 By Jeroen Berkers On 21-Mar-2013
0
Rated By 0 users Downloaded : 198
Categories : LISP Code Modules
Software type : AutoCAD 2013
Rename File To : today.lsp
Select the delimiter, format, and style for dates.

Jeroen Berkers says he has been using this code for years to format the current date. It is designed to be used inside other LISP routines, where it formats the current date with a user-defined delimiter, year format, and U.S. or international order. The function has three arguments. The first is a string to denote the delimiter; you might use "-" or "/" for example. For the second argument, supply either a 2 or 4 to designate the year format, and for the last argument, use "T" for U.S.-style dates (Month, Day) or nil for international-style dates (Day, Month).

Here are some examples:

  • (today "-" 4 nil) = 21-12-2013
  • (today "/" 2 nil) = 21/12/13
  • (today "_" 4 T) = 12_01_2013

 

 

Average Rating:
0


User comments