Lazarus

Miscellaneous => Suggestions => IDE/CodeTools => Topic started by: Anonymous on March 27, 2006, 03:23:25 am

Title: Code Templates and Today's Date
Post by: Anonymous on March 27, 2006, 03:23:25 am
Is it possible to build a code template which includes today's date? A macro something like $Date()? I couldn't see any macros available to do that.
Title: RE: Code Templates and Today
Post by: pch on March 27, 2006, 09:30:28 am
Look at the FPC documentation.
You can use :
Code: [Select]

{$I %DATE%}
{$I %TIME%}
Title: Re: RE: Code Templates and Today
Post by: Anonymous on March 28, 2006, 12:32:24 am
That doesn't do what I want. What I want to do is define a code template called, say, com. The template for com will look like:

// Changed: %DATE% Comment

I want %DATE% to be automatically substituted with today's date when I insert this comment line in code with "com" then CTRL+J so the text will be inserted as:

// Changed: 27/03/2006 Comment
Title: RE: Re: RE: Code Templates and Today
Post by: mattias on March 29, 2006, 11:37:54 am
I added the code macros $date, $time and $datetime.
Create a new template and add whatever you need.
Title: Re: RE: Re: RE: Code Templates and Today
Post by: Anonymous on April 07, 2006, 03:37:24 am
Quote from: "mattias"
I added the code macros $date, $time and $datetime.


Thanks. I just tried them in Lazarus 0.9.14 and they work great!
Title: Re: Code Templates and Today's Date
Post by: MarkMLl on June 30, 2022, 09:58:17 pm
I created a new template and added the code macros $date, $time and $datetime to try them out in Lazarus, it worked for me too.

(Clears throat) You're adding a "me too" to a message which is 16 years old.

Please don't do that, or people will start suspecting that you're a potentially-malicious AI responding to patterns it recognises.

MarkMLl
TinyPortal © 2005-2018