Recent

Author Topic: Code Templates and Today's Date  (Read 5913 times)

Anonymous

  • Guest
Code Templates and Today's Date
« 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.

pch

  • Jr. Member
  • **
  • Posts: 51
    • http://ap-i.net
RE: Code Templates and Today
« Reply #1 on: March 27, 2006, 09:30:28 am »
Look at the FPC documentation.
You can use :
Code: [Select]

{$I %DATE%}
{$I %TIME%}

Anonymous

  • Guest
Re: RE: Code Templates and Today
« Reply #2 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

mattias

  • Administrator
  • Full Member
  • *
  • Posts: 179
    • http://www.lazarus.freepascal.org
RE: Re: RE: Code Templates and Today
« Reply #3 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.

Anonymous

  • Guest
Re: RE: Re: RE: Code Templates and Today
« Reply #4 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!

MarkMLl

  • Hero Member
  • *****
  • Posts: 5561
Re: Code Templates and Today's Date
« Reply #5 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
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

 

TinyPortal © 2005-2018