Re: date format [message #72452] |
Thu, 09 September 2010 19:21 |
mkmvarma
Messages: 24 Registered: November 2007
|
Junior Member |
|
|
On Sep 10, 1:05 pm, Ben Tupper <ben.bigh...@gmail.com> wrote:
> On 9/9/10 6:51 PM, mahesh wrote:
>
>> Hi,
>> Is there any way I can change the date format from '970625' to
>> '19970625' in IDL?
>> Thanks,
>> Mahesh
>
> Hi,
>
> I hesitate to give the easy answer, but what the heck. IDL can do
> string math so the following works a treat.
>
> dateString = '970625'
> newDateString = '19' + dateString
>
> But if you really need to do date math then you need to split the string
> into a 2-digit-year, a month and a day using STRMID. Add the century
> (1900) to the 2-digit date. Then you run the while thing JULDAY before
> doing math on it.
>
> Cheers,
> Ben
Thanks very much, Ben. It worked.. I had to use STRMID though ....
Mahesh
|
|
|
Re: date format [message #72453 is a reply to message #72452] |
Thu, 09 September 2010 18:05  |
ben.bighair
Messages: 221 Registered: April 2007
|
Senior Member |
|
|
On 9/9/10 6:51 PM, mahesh wrote:
> Hi,
> Is there any way I can change the date format from '970625' to
> '19970625' in IDL?
> Thanks,
> Mahesh
Hi,
I hesitate to give the easy answer, but what the heck. IDL can do
string math so the following works a treat.
dateString = '970625'
newDateString = '19' + dateString
But if you really need to do date math then you need to split the string
into a 2-digit-year, a month and a day using STRMID. Add the century
(1900) to the 2-digit date. Then you run the while thing JULDAY before
doing math on it.
Cheers,
Ben
|
|
|