# Re: [ferret_users] how to convert decimal date to date and time

```Hi Yogesh,
Just had a quick look on the details you provided. Here is
a solution, assuming NOLEAP calendar with a constant 365 days length for
every year (please see the files in attached tar/gzipped file,
date_decimal.tar.gz).

Suppose the accurate year length is not 365 days. Then there are two
possibilities (excluding the 360_DAY calendar) :

1. every year does have equal length: either 365.25 (JULIAN) or
365.2425 (GREGORIAN) days
2. normal years have a length of 365 days and leap years have a
length of 366 days.

If you precisely know which category your data belongs to, then modify
date_decimal.jnl file (attached) according to that.

Hope this helps,

Regards,

Jaison

On Tue, 7 Aug 2007, Yogesh Tiwari wrote:

> Hi Jaison,
>
>
> > Hi Yogesh,
> > following basic details :
> >
> >   1. In 2006.121918, what does the ".121918" stands for? does it mean
> >       month=12, day=19, hours=18?
> >
> >       or is it a fraction found by deviding month, day, hour, minute and
> >       second with the year length and adding together?
>
>
>  2006.121918 stands for year plus fraction of the year. Fraction as well is
> year and calculated as you said above.  Each year has 48 weekly steps.
>
>   2. What is the calendar type? Julian, Gregorian, Noleap ....?
>
>
> Its observation given in UTC and year is divided in 48 weeks then its
>  Julian I guess.
>
>   3. What all other variables you have in the ascii file? Please provide
>         the first few datalines.
>
> Basically its atmospheric CO2 observed data , and given like:
>
>
> Time                CO2(ppm)
>
> 1993.333333    361.7010
>
> 1993.354167    361.0350
>
> 1993.375000    360.2820
>
> 1993.395833    359.5100
>
> Thanks,
>
>
> Regards,
>
> Yogesh
>
>
>
> On Tue, 7 Aug 2007, Yogesh Tiwari wrote:
>
> > Hello Ferret Users,
> >
> > I have an ASCII file in which one column represents decimal date,
> something
> > like   2006.121918
> >
> > I want to convert  this decimal date in equivalent date in the format YYYY
> > mm dd hr min sec
> >  and write separate six columns.
> >
> > Is it possible in ferret ?
> >
> > Thanks,
> >
> > Cheers,
> > Yogesh
> >
> >
>
> --
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
>
>
>
>
>
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

```

Attachment: decimal_date.tar.gz
Description: GNU Zip compressed data

• Follow-Ups: