Re: Coverting date format was: Problems with Ut_string

From: ugo merlini <ugomerlini_at_nyahnyahspammersnyahnyah>
Date: Wed Oct 05 2011 - 12:53:46 MDT

Hi,

thanks for code!!!

I really appreciate it

Regards

Ugo

> Date: Wed, 5 Oct 2011 11:15:53 -0500
> From: d-cote@tamu.edu
> To: ncl-talk@ucar.edu; ugomerlini@hotmail.com
> Subject: Re: Coverting date format was: Problems with Ut_string
>
> I should have reset the Subject line. Ugo, I'm sending an extra copy to
> your email address. -Donna
>
> On 10/4/11 3:27 PM, ncl-talk-request@ucar.edu wrote:
> > Date: Tue, 04 Oct 2011 14:29:44 -0500
> > From: donna Cote<d-cote@tamu.edu>
> > Subject: Re: ncl-talk Digest, Vol 95, Issue 5
> > To:ncl-talk@ucar.edu
> > Message-ID:<4E8B5EA8.1010906@tamu.edu>
> > Content-Type: text/plain; charset=ISO-8859-1; format=flowed
> >
> > Ugo, for adding 2 hours, I would find the NCL date functions more
> > useful. You might look over this. It's what I use often:
> > $ cat timetest.ncl
> > date1String=systemfunc( "date +%Y%m%d%H" )
> > print("given string as YYYYMMDDHH is "+date1String)
> >
> > yearInt = stringtointeger( str_get_cols( date1String, 0, 3) )
> > monInt = stringtointeger( str_get_cols( date1String, 4, 5) )
> > dayInt = stringtointeger( str_get_cols( date1String, 6, 7) )
> > hrInt = stringtointeger( str_get_cols( date1String, 8, 9) )
> > timeUnits = "hours since 1800-01-01 00:00:00"
> >
> > date1Time = ut_inv_calendar( yearInt, monInt, dayInt, hrInt, 0, 0,
> > timeUnits, 0 )
> >
> > ; since date1Time has the units "hours since ..." the 2 here adds 2 hours
> > date2Time = date1Time + 2
> > date2Time@units = timeUnits
> > ;print(date2Time@units)
> >
> > date2Int = ut_calendar( date2Time, -3 )
> > ;print(date2Int)
> >
> > date2String=sprinti ( "%0.8i", date2Int )
> > ;print(date2String)
> >
> > ymd2String=str_get_cols ( date2String, 0, 7 )
> > hr2String =str_get_cols ( date2String, 8, 9 )
> >
> > newDate2String=systemfunc( "date -d '"+ymd2String+" "+hr2String+"' '+%A,
> > %d/%m/%Y %H'" )
> > print("new string is "+newDate2String)
> >
> > ;date -d "20111004 05" +"%A, %d/%m/%Y"
> >
> > $ ncl timetest.ncl
> > Copyright (C) 1995-2011 - All Rights Reserved
> > University Corporation for Atmospheric Research
> > NCAR Command Language Version 6.0.0
> > The use of this software is governed by a License Agreement.
> > Seehttp://www.ncl.ucar.edu/ for more details.
> > (0) given string as YYYYMMDDHH is 2011100414
> > (0) new string is Tuesday, 04/10/2011 16
> > $
> >
> >
> > On 10/4/11 1:00 PM,ncl-talk-request@ucar.edu wrote:
> >> > Date: Mon, 3 Oct 2011 19:00:46 +0000
> >> > From: ugo merlini<ugomerlini@hotmail.com>
> >> > Subject: Coverting date format was: Problems with Ut_string
> >> > To:<ncl-talk@ucar.edu>
> >> > Message-ID:<DUB108-W421534FE7D84406AC15C56CAFA0@phx.gbl>
> >> > Content-Type: text/plain; charset="iso-8859-1"
> >> >
> >> >
> >> > Hi
> >> >
> >> > I would like to convert the date format from the standard one to
> >> >
> >> > date -d "20111002 03 +2 hour" +"%A, %d/%m/%Y ore %H"
> >> >
> >> > I write a little script
> >> >
> >> > can someone help to go to the right way?
> >> >
> >> > is better to use internal NCL function instead of Unix shell command?
> >> >
> >> > Regards
> >> >
> >> > Ugo
                                               

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Oct 5 12:53:55 2011

This archive was generated by hypermail 2.1.8 : Sun Oct 09 2011 - 13:05:26 MDT