Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date Format

Status
Not open for further replies.

RF101

Technical User
May 17, 2006
33
US

Hello,

I am trying to automatically collect a file hourly with the following naming convention:

06100512 which is YYMMDDHH

I tried using the following line:

strfmt sGetPCMD "get %02d%02d%02d%02d.PCMD.gz^M" iYear iMonth iDay iHour

This is close but it gives me 4 digit Year instead of 2

Any ideas?
 

After a few searches I found my answer in another post.

The trick that was posted seems to work.

I added a new line like below:

strdelete sGetPCMD 4 2

This deleted the extra fields out of the Year that I did not want.

Thanks,

RF101
 
Are you using ltimeints or a similar comand to get the hour, month, etc.? If so, probably the easiest "fix" is to subtract 2000 from the year so you have only a two digit value for that two digit field. strfmt will not "chop" a four digit integer to fit into two digits, so that's the immediate workaround.

 
This sounds good too.

Thanks,

RF101
 
I usually convert the year to a string and format that.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top