> Dear all
> I would like to split the following number 20100115 into year, month
> and day
> any suggestions
> Thanks
Something like this:
IDL> ts = '20100115'
IDL> year = long(strmid(ts, 0, 4))
IDL> month = long(strmid(ts, 4, 2))
IDL> day = long(strmid(ts, 6, 2))
IDL> help, year, month, day
YEAR LONG = 2010
MONTH LONG = 1
DAY LONG = 15
> On 6/22/12 1:52 PM, k_ghr...@yahoo.com wrote:
> > Dear all
> > I would like to split the following number 20100115 into year, month
> > and day
> > any suggestions
> > Thanks
> Something like this:
> IDL> ts = '20100115'
> IDL> year = long(strmid(ts, 0, 4))
> IDL> month = long(strmid(ts, 4, 2))
> IDL> day = long(strmid(ts, 6, 2))
> IDL> help, year, month, day
> YEAR LONG = 2010
> MONTH LONG = 1
> DAY LONG = 15
Or
year = 0
month = 0
day = 0
READS, ts, year, month, day, FORMAT = "(I4,2I2)"
> In article <js2mga$jh...@dont-email.me>, Michael Galloy <mgal...@gmail.com>
> wrote:
> > On 6/22/12 1:52 PM, k_ghr...@yahoo.com wrote:
> > > Dear all
> > > I would like to split the following number 20100115 into year, month
> > > and day
> > > any suggestions
> > > Thanks
> > Something like this:
> > IDL> ts = '20100115'
> > IDL> year = long(strmid(ts, 0, 4))
> > IDL> month = long(strmid(ts, 4, 2))
> > IDL> day = long(strmid(ts, 6, 2))
> > IDL> help, year, month, day
> > YEAR LONG = 2010
> > MONTH LONG = 1
> > DAY LONG = 15
> Or
> year = 0
> month = 0
> day = 0
> READS, ts, year, month, day, FORMAT = "(I4,2I2)"
> Cheers, Ken
Thanks for your help
first you convert a long number to a string by put it between ' '
but if i have a long array like this
20100101 20100101 20100101 20100101 20100102
20100102 20100102 20100102 20100103 20100103
20100103 20100103 20100104
and I cann't put each sub group between ' '
how I can split this directly?
Best wishes
Khaled
Thanks for your help
first you convert a long number to a string by put it between ' '
but if i have a long array like this
20100101 20100101 20100101 20100101 20100102
20100102 20100102 20100102 20100103 20100103
20100103 20100103 20100104
and I cann't put each sub group between ' '
how I can split this directly?
Best wishes
Khaled