[ncl-talk] systemfunc("date")

Joseph Zambon jbzambon at ncsu.edu
Mon Dec 1 04:57:34 MST 2014


Mark,

For your application, the date string for the UNIX command would be...

date +'%Y-%m-%d-T%H:%M:%S'

as in...
jbzambon@:~$ date +'%Y-%m-%d-T%H:%M:%S'
2014-12-01-T11:56:02

As you have been doing, use systemfunc along with that UNIX function to get the desired output...

ncl 6> creation_date =systemfunc("date +'%Y-%m-%d-T%H:%M:%S'") 
ncl 7> print(creation_date)                                     


Variable: creation_date
Type: string
Total Size: 8 bytes
            1 values
Number of Dimensions: 1
Dimensions and sizes:	[1]
Coordinates: 
(0)	2014-12-01-T11:57:35

See the man date page for more info on formatting from the date function.
http://unixhelp.ed.ac.uk/CGI/man-cgi?date

-Joe


Joseph B. Zambon
NC State University
Department of Marine, Earth and Atmospheric Sciences
Jordan 4133
jbzambon at ncsu.edu
www.joezambon.com



On Dec 1, 2014, at 6:41 AM, Mark Chan <cym263 at yahoo.com> wrote:

> Dear NCL users,
> 
> In the below is a way to create the "date". How could I make the date format as: "2014-11-28-T15:50:49Z"?
> 
> Thanks a lot,
> Mark
> 
> ========
> fileAtt at creation_date =systemfunc("date") 
> :creation_date = "Fri Nov 28 15:50:49 CET 2014" ;
> 
> 
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20141201/73a0d3f2/attachment.html 


More information about the ncl-talk mailing list