cag8f Posted March 12, 2021 Share Posted March 12, 2021 Hi all. The `@year` macros inserts the current four digit year. But is there a macro (or alternative) to insert the two digit year? If not, how would I best obtain the two digit year? If I first obtain the four digit year as a number, is there a function I can use to strip off the first two digits? Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted March 12, 2021 Share Posted March 12, 2021 @cag8f ConsoleWrite("Two Digits Year: " & _TwoDigitsYear() & @CRLF) Func _TwoDigitsYear() Return StringRight(@YEAR, 2) EndFunc argumentum 1 Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
cag8f Posted March 12, 2021 Author Share Posted March 12, 2021 Great thanks for that. It works 🙂 Link to comment Share on other sites More sharing options...
nend Posted March 12, 2021 Share Posted March 12, 2021 With regex in 1 line ConsoleWrite(StringRegExpReplace(@YEAR, "^(\d{2})", "", 0) & @CRLF) Xandy 1 Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted March 12, 2021 Moderators Share Posted March 12, 2021 Still in one line: ConsoleWrite(StringRight(@YEAR, 2) & @CRLF) seadoggie01 and Xandy 2 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
JockoDundee Posted March 12, 2021 Share Posted March 12, 2021 Y2.1K safe solution ConsoleWrite(@YEAR-2000 & @CRLF) FrancescoDiMuro 1 Code hard, but don’t hard code... Link to comment Share on other sites More sharing options...
Nine Posted March 12, 2021 Share Posted March 12, 2021 A safer way (in case someone wants to do 19xx year) : ConsoleWrite (Mod(@YEAR, 100) & @CRLF) “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
JockoDundee Posted March 12, 2021 Share Posted March 12, 2021 2 minutes ago, Nine said: in case someone wants to do 19xx year by setting their system clock back? AspirinJunkie and Musashi 2 Code hard, but don’t hard code... Link to comment Share on other sites More sharing options...
Nine Posted March 12, 2021 Share Posted March 12, 2021 Ya that's one possibility. But who knows, someone could invent a machine to go back in time...AutoIt would still be useful then ! Musashi 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
AspirinJunkie Posted March 12, 2021 Share Posted March 12, 2021 37 minutes ago, Nine said: A safer way (in case someone wants to do 19xx year) : ConsoleWrite (Mod(@YEAR, 100) & @CRLF) cag8f will be very sad in the year 2100-2109 because his script will output only one-digit year numbers... 😄 Musashi 1 Link to comment Share on other sites More sharing options...
Musashi Posted March 12, 2021 Share Posted March 12, 2021 41 minutes ago, AspirinJunkie said: cag8f will be very sad in the year 2100-2109 because his script will output only one-digit year numbers... 😄 At least he should have received his first CoVID-19 vaccination by then (if he is lucky) . "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." Link to comment Share on other sites More sharing options...
JockoDundee Posted March 12, 2021 Share Posted March 12, 2021 23 minutes ago, AspirinJunkie said: cag8f will be very sad in the year yes, but he’ll be able to re-experience the Y2K bug all over again... Code hard, but don’t hard code... Link to comment Share on other sites More sharing options...
Nine Posted March 12, 2021 Share Posted March 12, 2021 1 hour ago, Musashi said: CoVID-19 What is that ? A new programming language ? “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Musashi Posted March 12, 2021 Share Posted March 12, 2021 38 minutes ago, Nine said: CoVID-19 - What is that ? A new programming language ? No, this is the long time and desperately awaited compiler for AutoIt . "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now