By registering with us, you'll be able to discuss, share and private message with other members of our community.
SignUp Now!From: CWBillow
| Of these two, the first still gave me errors (10 second pause), but
| the second one worked fine.
|
| dd2=Md "%@date[%_date %_time]
| dd3=Md "%@replace[/,-,%_date] %@replace[:,.,%_time]"
From the format, I presume you do this in an alias definition file. Did you look at _isodate?
One more comment. The method of obtaining the date and time in separate calls to the OS has bit me in the past - if you happen to do it within a few milliseconds before midnight, the date and time returned could be from different days, resulting in a combination nearly 24 hours obsolete... Two methods available to fix this, one a lot more elaborate than would suit an alias: get date, get time, get date again - if dates mismatch, get time again. The other is to use the single call made obtaining _DATETIME, and editing its value into the format you want, along the lines (NOT TESTED!!!):
alias dd=`SET z=%_datetime %+ MD "%@instr[0,4,%z]-%@instr[4,2,%z]-%@instr[6,2,%z] %@instr[8,2,%z].%@instr[10,2,%z].%@instr[12,2,%z]"`
BTW, you can force _date and _time to return data in the format you want by setting the registry format for short date and time, either temporarily (for the execution of the MD command), or permanently.
--
HTH, Steve
Ooppps not surprised the first one gives an error ... the _time variable does not belong
there sorry! Chuck
Time is ignored! In dd2
: -----Original Message-----
: Subject: RE: [Support-t-3331] Re: Make a folder named Date-Time
:
: Of these two, the first still gave me errors (10 second pause), but the second one
worked fine.
:
: dd2=Md "%@date[%_date %_time]
: dd3=Md "%@replace[/,-,%_date] %@replace[:,.,%_time]"
:
: Thanks,
: Charles
I don't know if any of your issues are related to not having backquotes
around your alias definition.
For example, these two definitions will yield different results:
alias mdd1=`Md "%@replace[/,-,%_date] %@replace[:,.,%_time]"`
alias mdd2=Md "%@replace[/,-,%_date] %@replace[:,.,%_time]"
alias
mdd1=Md "%@replace[/,-,%_date] %@replace[:,.,%_time]"
mdd2=Md "11-02-11 10.53.51"
-Scott
Ooppps not surprised the first one gives an error ... the _time variable
does not belong
there sorry! Chuck
Time is ignored! In dd2
: -----Original Message-----
: Subject: RE: [Support-t-3331] Re: Make a folder named Date-Time
:
: Of these two, the first still gave me errors (10 second pause), but the
second one
worked fine.
:
: dd2=Md "%@date[%_date %_time]
: dd3=Md "%@replace[/,-,%_date] %@replace[:,.,%_time]"
:
: Thanks,
: Charles
Hello Steve,I only reference _date/_isodate, _hour, and _minute individually to obtain the current date and time if I can guarantee that midnight cannot occur between the first and last reference. Otherwise I always use a single access to the system clock, usually via _datetime, and if I need the individual elements I use @instr[] on the string returned:
set now=%_datetime
set foldername="%@instr[2,2,%now]-%@instr[2,2,%now]-%@instr[4,2,%now] %@instr[6,2,%now]-%@instr[8,2,%now]"
to generate a name in which the date (using 2-digit year) and time (using hyphen between hours and minutes, no seconds) are separated by a single space. For my own use, I typically use NO separators, which makes it much simpler; to avoid very large directories (e.g. the parent directory of all these folders) I typically break it into a hierarchy - for frequent items (e.g., pictures of events) I make year+month one level, and day+time a lower level. For less frequent items (e.g., monthly bills) year is the higher level.
--
HTH, Steve