[ncl-talk] systemfunc("date")

Kyle Griffin ksgriffin2 at wisc.edu
Mon Dec 1 07:44:48 MST 2014


Although this is likely a minor detail in the example you posted, it
appears you want things in UTC (hence the Z at the end of the timestamp).
Joe's response only works if your computer defaults to UTC as its time
zone. Otherwise, date -u +....... will be necessary to ensure the command
works regardless of the local time setting.


Kyle

----------------------------------------
Kyle S. Griffin
Department of Atmospheric and Oceanic Sciences
University of Wisconsin - Madison
Room 1421
1225 W Dayton St, Madison, WI 53706
Email: ksgriffin2 at wisc.edu

On Mon, Dec 1, 2014 at 5:57 AM, Joseph Zambon <jbzambon at ncsu.edu> wrote:

> 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
>
>
>
> _______________________________________________
> 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/0549e568/attachment.html 


More information about the ncl-talk mailing list