Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

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

Oct
364
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.
 
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[%$]]`
 
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]
 
Oooh, I think you are right. I must never have run it between 12 and 1 pm....:smile: Thanks Charles!
 

Similar threads

Back
Top