let cDate = spawn("date --date='($current_date)' +'%d–%b–%y'")
define sym cdate `cDate`
!-> define sym cdate 03–Apr–18
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
Ge
Peng, PhD
Research Scholar
Cooperative
Institute for Climate and Satellites - NC (CICS-NC)/NCSU at
NOAA’s National Centers for Environmental Information (NCEI)
Center for Weather and Climate (CWC)
151 Patton Ave, Asheville, NC
28801
+1 828 257 3009; ge.peng@xxxxxxxx
ORCID: http://orcid.org/0000-0002-1986-9115
Following CICS-NC on Facebook