[ncl-talk] convert yyyymmdd to string

Alan Brammer abrammer at albany.edu
Sun Apr 10 12:03:43 MDT 2016


Chang, 

I wrote this a while back.  Uses pretty much the same code that is passed around in examples and on here quite often when these questions about yyyymmdd times comes up.  

You could use this with cd_string() to get your desired result. 




Alan



##############################
Alan Brammer,
Post-Doc Researcher

Department of Atmospheric and Environmental Sciences,
University at Albany, State University of New York, Albany, NY, 12222
abrammer at albany.edu
##############################



> On 4 Apr 2016, at 13:59, Dave Allured - NOAA Affiliate <dave.allured at noaa.gov> wrote:
> 
> Chang,
> 
> No, there is no such fuction in the current NCL function library.  You could do this by parsing yyyymmdd into 3 integer parts, then call cd_inv_calendar, followed by cd_string.
> 
>     http://www.ncl.ucar.edu/Document/Functions/date.shtml <http://www.ncl.ucar.edu/Document/Functions/date.shtml>
> 
> However, that is more complicated than necessary, and there are side issues.  I recommend writing your own function; it should be quite easy.  You will still need to parse yyyymmdd into 3 parts.  Use sprinti ("%2.2i", dd) to make the day number into a 2-digit string.
> 
> --Dave
> 
> 
> On Mon, Apr 4, 2016 at 10:38 AM, Xi Chang <xi.chang01 at gmail.com <mailto:xi.chang01 at gmail.com>> wrote:
> Hi NCL,
> 
> is there any a function that is able to convert the calender date with format
> yyyymmdd to dd-month-yyyy? where month is e.g., Jan, Feb etc.
> 
> Thank you
> 
> Chang..
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> 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/20160410/892d3158/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: yyyymmdd_to_cd.ncl
Type: application/octet-stream
Size: 1076 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160410/892d3158/attachment.obj 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160410/892d3158/attachment-0001.html 


More information about the ncl-talk mailing list