[ncl-talk] unable to convert date and time
Rick Brownrigg
brownrig at ucar.edu
Thu Mar 19 08:30:33 MDT 2020
I think you want cd_string, not cd_convert:
http://ncl.ucar.edu/Document/Functions/User_contributed/cd_string.shtml
>From those docs, I'm not sure it will give days as "2nd", "3rd"..."31st",
etc, but it will certain give 2, or 02, etc.
It looks like cd_convert is used to convert various linear time units, ex,
"days from..." to "months from...", etc.
Rick
On Thu, Mar 19, 2020 at 3:46 AM Geeta Geeta via ncl-talk <ncl-talk at ucar.edu>
wrote:
> Hi
> in my code, I have extracted the dats which looks like 20090402 (2nd
> April2009).I have to convert it to the format 02apr2009.
>
> I am using cd_convert to write the date and time in the required format.
>
> Following is the lines from the code. I have added units to this
> variable YYMMDD
>
> YYMMDD = stringtointeger(Split_name(1)) ; string
> variable
>
> print(YYMMDD)
> YYMMDD at units = "days since 0000-01-01 00:00:0.0"
> ; printVarSummary(YYMMDD)
>
> stime = cd_convert(YYMMDD,"%c%y")
> ; print(stime)
>
>
> I get error like this
> CDMS error: Error on relative units conversion: invalid units = %c%y
>
> kindly suggest
>
>
> Geeta.
> _______________________________________________
> 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/20200319/ec89222e/attachment.html>
More information about the ncl-talk
mailing list