Declined Padding option(s): @Day, @Month, @Doy

Oct 18, 2009
362
17
Ability to add user-specified padding for @Day, @Month, @Doy

I routinely create folders with the name format 01 - Jan 2018 or the date format 01, so when I list in File Manager/Windows Explorer I don't wind up with 1, 10, 11, ..., 19, 2, 20, 21 ...

To use the current options I have to prepend a 0 and then take the last 2 characters. (I don't use _doy or @doy.)

Since this often would be returning a string, it might need different variable names, either that or add an optional second parameter to indicate that the function will return a string rather than an integer.
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,491
90
Albuquerque, NM
prospero.unm.edu
I realize this is not what you're asking for, but it might be helpful to others....

You can roll your own using FUNCTION:
Code:
function day2=`%@formatn[02.0,%@day[%$]]`
function month2=`%@formatn[02.0,%@month[%$]]`
function doy3=`%@formatn[03.0,%@doy[%$]]`
 
May 20, 2008
11,520
102
Syracuse, NY, USA
Or, if you're not using @DAY's format parameter, perhaps the likes of this.
Code:
v:\> function pday `%@if["%2" eq "p",%@format[02,%@day[%1]],%@day[%1]]`

v:\> echo %@pday[2018-08-06]
6

v:\> echo %@pday[2018-08-06,p]
06

v:\> echo %@pday[2018-08-16,p]
16
 
Another example of ways to manipuate time. I wanted %_time to spit out am and pm so here is a custom function that does it. Pretty easy. I think Charles's example will do what you need.

Code:
TimeAMPM = %@if[%@Left[2,%_Time] LE 12,%_Time AM,%@Format[2,0%@Eval[%@Left[2,%_Time]-12]]:%@FormatN[02.0,%_Minute]:%@FormatN[02.0,%_Second] PM]
 
Similar threads
Thread starter Title Forum Replies Date
vefatica Done Option to suppress blank lines in WMIQUERY Suggestions 1
M Done SFTP with a public key auth option Suggestions 2
R Option to add tcc to Bash profile Suggestions 1
vefatica INI option to disable everything GUI ... Suggestions 7
D Suggestion: VIEW option to open VIEW over tab window but not keep it there Suggestions 0
D Done Suggestion: Add VIEW option to open in same position as current window Suggestions 0
Fross Done Option to screen center msgbox Suggestions 2
P Done Have option not to pause TCMD console output when mouse is clicked elsewhere Suggestions 0
D Done BDEBUGGER: add cmdline option to set a breakpoint at a given line Suggestions 0
vefatica Done PAUSE: option to overwrite the prompt Suggestions 2
A Declined Enhance OPTION command functionality Suggestions 2
R Declined Install option: Add File Explorer Run As Adminstrator option Suggestions 14
Charles Dye Done TCEDIT: Command-line option to print files Suggestions 2
Charles Dye Done REGDIR: Hex display option Suggestions 1
Charles Dye TCEDIT: Path search option Suggestions 1
Charles Dye Done @SNAPSHOT: Add option to capture the entire virtual screen Suggestions 0
Charles Dye TASKLIST: Option to mark WOW64 processes Suggestions 0
Charles Dye Done PRINT: Option to set default printer Suggestions 0
A Declined An installer option to control .btm association Suggestions 0
Oz Solomon Done Recycle/Reuse window option for TCMD Suggestions 6
Charles Dye Done Option to prevent recursion into System subdirectories Suggestions 0
L Completing the UnQLite command's option set Suggestions 0
jaejunks Done Option for case-sensitive string comparison in IF command (for CMD compatibility) Suggestions 1
rps Declined ECHO -- Add spacing option Suggestions 2
rps Declined TPIPE first match & count option Suggestions 2
rps Done Pause /wait option addition Suggestions 1
vefatica Done TIMER ... a partially quiet option Suggestions 1
mfarah "Relative path" option for PDIR Suggestions 1
D Done Add VIEW option to open in same position as current window Suggestions 0
R Done Find in screen buffer - case sensitive 'option' Suggestions 2
rconn Add option to run programs Elevated from toolbar buttons Suggestions 0
G Declined Add option to turn on file name case sensitivity Suggestions 6
M Done A suggested PDir option... Suggestions 2
Charles Dye Done New TYPE option Suggestions 0
S Declined Add /W(ipe) option to several commands Suggestions 17
S Declined New command or new ACTIVATE option request Suggestions 5
B Done PDIR Field Separator Option Request Suggestions 3
W Done Add an option to control command line parsing Suggestions 7
yjchung Declined Unblocking option for MSGBOX? Suggestions 8
E Declined Add option to use SFN for ComSpec variable Suggestions 8

Similar threads