CLF = WTF?

Robert Brenstein rjb at robelko.com
Sat Mar 7 17:13:09 EST 2009


>  2. Right now I'm parsing the CLF date and reformatting it into "internet
>  date" using about a dozen lines of code, and maybe it could be
>  simplified a bit more but what I'd ideally like is the efficiency of a
>  one-liner.  Anyone here know of a what to alter CLF dates into a form
>  that will survive Rev's "convert" command in one or two lines?

You don't say what you really want to do with that date, so this may 
be going in wrong direction. However, since the format is fixed, you 
can try

get (char 8 to 11 of it) & comma & lineoffset(char 4 to 6 of it, the 
monthnames) & comma & (char 1 to 2 of it) & comma & (char 13 to 14 of 
it) & comma & (char 16 to 17 of it) & comma & (char 19 to 20 of it) & 
comma & zero

that gives you dateitems which you can then

convert it to internet date

the only side-effect is that time zone is changed to the time zone of 
local computer

If you can skip day of the week, you can the internet date more directly

get (char 1 to 2 of it) && (char 4 to 6 of it) && (char 8 to 11 of 
it) && (char 13 to -1 of it)

If you really need dateitems or seconds for analysis

get "Sun," && (char 1 to 2 of it) && (char 4 to 6 of it) && (char 8 
to 11 of it) && (char 13 to -1 of it)
convert it to seconds -- or dateitems

Robert



More information about the Use-livecode mailing list