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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change part of Date output to Alpha

Status
Not open for further replies.

SL100guy

IS-IT--Management
Sep 29, 2003
20
0
0
US
I can't figure out how to get iMonth to reflect a three character alpha output for dateFileName i.e. OUTPUT: 12 AUG 2009.

The second part of this request for assistance is to ask how to convert the 2009 output to 09 output instead. FINAL OUTPUT: 12 AUG 09

SCRIPT:

string datefilename

proc main
clear
datefilename = ""
file_date()
endproc

proc file_date
integer iMonth, iDay, iYear, iHour, iMin, iSec
ltimeints $LTIME iMonth iDay iYear iHour iMin iSec
strfmt dateFileName " %02d %02d %02d" iYear iDay iMonth
termmsg dateFileName
endproc
 
This code comes from the help file (ltimeints):

Code:
proc main
   integer Month, Day         ; Integers to contain date and
   integer Year, Hour         ; time converted from long
   integer Min, Sec           ; date and time.
   string MonStr              ; String to contain month.

   ; Convert long time value into it's counter parts, year,
   ; month, day, hour, min, and sec.
   ltimeints $LTIME Year Month Day Hour Min Sec
   monthstr Month MonStr   ; Get the month in string format.
   usermsg "Month is %s and it's day %d." MonStr Day

endproc
 
To answer the second part about turning 2009 into 09, you can use the strdelete command to remove the two leading digits from the year as such:

strdelete iYear 0 2

 
Thanks that got me pointed in the right direction. I got what I need now. Cheers!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top