[Thread Prev][Thread Next][Index]

Re: [ferret_users] constructing output file names with zero-filled current date string



Hi Peng,

I need to extract the current date and use it in my output file name. How do I convert:

 

    current_date =” 2-Apr-18”

 

to a fix length, zero-filled date string: cDate=“02-Apr-18”?  


let a = SPAWN("gdate --date='2-Apr-18' +'%d-%b-%y'")
define symbol cDate `a`

The SPAWN() function runs the shell command and gets its output.  I use the command "gdate" above for the GNU version of the "date" command.  On Linux, use "date".  To check if it's the right date command, look at "date --version".

Ryo

[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement