Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Insert formatted date
My very first excursion into this great program, so be kind. I've been trying to write a macro to insert the system date into a text editor. All the format options are nice and when I overcome the first step I'll try 'em out. Right now the system short form will do. Please point the way.

1. Declare str variable.
2. With that variable, call function time with formatting string.
3. Paste that variable.

Example1 - month/day/year
Copy      Help
str s
out s

More date-time formatting examples

Example2 - date
Copy      Help
out s.time("%x")

Example3 - date and time
Copy      Help
out s.time("%c")

Example4 - short-weekday short-month day hour:min
Copy      Help
out s.time("%a %b %#d %H:%M")

As you see, %x is replaced to date, %#d to day, etc.
Characters that aren't preceded by % (in example - spaces and colon) are unchanged.
Thank you, kind one! I thought it would be simple and it was, but somehow I missed the declaration. Also took a look at the dll GetLocalTime function and at least printed out the Hour. But that is the long way, I think.


Forum Jump:

Users browsing this thread: 1 Guest(s)