# Re: Time delta

From: Marston Johnston <shejo284_at_nyahnyahspammersnyahnyah>
Date: Wed Dec 04 2013 - 23:09:04 MST

Hi,

Thanks, that will solve the problem for me.

/M

On Wed, Dec 4, 2013 at 11:02 PM, Dennis Shea <shea@ucar.edu> wrote:

> There are many ime/date functions in NCL. See:
> http://www.ncl.ucar.edu/Document/Functions/date.shtml
>
> ===
> untested
> ===
> year = 2005
> mon = 1
> day = 1
> hour = 10
> minit= 55
>
> tunits = "hours since 1800-01-01 00:00" ; arbitrary, *ANY* date is ok
>
> ; http://www.ncl.ucar.edu/Document/Functions/Built-in/
> cd_inv_calendar.shtml
>
> time = cd_inv_calendar(year,mon,day,hour,minit,0,tunits, 0)
> print(time)
>
> time24= time - 24
> time24@units = time@units
>
> ; http://www.ncl.ucar.edu/Document/Functions/Built-in/cd_calendar.shtml
>
> date24 = cd_calendar(time24,0)
> print(date24)
> ===
>
> If you had chosen (say):
>
> tunits = "seconds since 1800-01-01 00:00"
>
> then
>
> time24= time - 24*3600
>
> When shifting times, you must be consistent with
> the units attribute.
>
>
>
> On 12/4/13, 2:22 PM, Marston Johnston wrote:
>
>> Hi,
>>
>> I'm wondering if NCL can do time difference, or time delta calulations?
>> For
>> example,
>> I've I have a time 2005,01,01,10,55,0, which is 10:55 on Jan 1st 2005, and
>> I want to find out the hour, minute, day, month, and year if I take away
>> of
>> add 48 hours, or 24 hours, etc., does NCL have a function for this type of
>> calculations?
>>
>> Sincerely,
>> /Marston
>>
>>
>>
>> _______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>

```--
Only the fruitful thing is true!

```

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Dec 4 23:09:18 2013

This archive was generated by hypermail 2.1.8 : Fri Dec 13 2013 - 11:39:30 MST