comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Parsing dates (ARGH!)
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Parsing dates (ARGH!) [message #39459] Mon, 17 May 2004 09:49 Go to next message
jamiesmyth_uni is currently offline  jamiesmyth_uni
Messages: 6
Registered: May 2004
Junior Member
Can someone please explain how I can parse the year, month, day, hour,
minute, and seconds from a timestamp such as '2004-01-01
01:22:15.1234'

IDL> print, a
2004-01-01 00:10:22
IDL> print, size(a, /tname)
STRING
IDL> sql_fmt = "(C(CYI4, X, CMoI2.2, X, CDI2.2, X, CHI2.2, X," + $
IDL> " CMI2.2, X, CSF7.4))"
IDL> reads, a, year, format=sql_fmt
IDL> help, year
YEAR INT = 28173
IDL> reads, a, year, month, date, hour, minute, seconds,
format=sql_fmt
% READS: End of input data encountered: A
% Execution halted at: $MAIN$

Thanks, I've blown most of the morning on this...
Re: Parsing dates (ARGH!) [message #39495 is a reply to message #39459] Mon, 17 May 2004 10:28 Go to previous message
mperrin+news is currently offline  mperrin+news
Messages: 81
Registered: May 2001
Member
Jamie Smyth <jamiesmyth_uni@yahoo.ca> wrote:
> Can someone please explain how I can parse the year, month, day, hour,
> minute, and seconds from a timestamp such as '2004-01-01
> 01:22:15.1234'
>
> IDL> print, a
> 2004-01-01 00:10:22

Take a look at
http://idlastro.gsfc.nasa.gov/ftp/pro/astro/date_conv.pro

IDL> result = date_conv(a,"V")
IDL> print,result[0]
2004


date_conv isn't *exactly* what you want, since result[1] is
"day of year (0-366)" as opposed to month and then day, but
if you take a look at the code it should be pretty straightforward
to modify for your purposes...

- Marshall
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Unpacking algoritmn
Next Topic: Re: Parsing dates (ARGH!)

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Oct 11 20:01:08 PDT 2025

Total time taken to generate the page: 0.96051 seconds