Convert date and time to a number to chart

Sarah sarahr at genesearch.com.au
Wed May 15 17:42:01 EDT 2002


Dear Bill,

My script uses dates only, without attached times, but I have used 
variables with convert before so I knew it could be done. After some 
experimentation with your data, here is a working convert script:

on mouseUp
   set the twelveHourTime to false  -- as you are using 24 hour time
   set the itemDelimiter to tab

   put "5/11/2002	0:0:11" into timeStamp
   replace tab with space in timeStamp
   convert timeStamp from short date and long time to seconds
   -- now timeStamp is numeric

   -- just to confirm that it worked, don't put this bit in your script
   put timeStamp into checkTime
   convert checkTime from seconds to short date and long time
   answer timeStamp & cr & checkTime
   -- this should give you back your original date & time as well as the 
numeric version
end mouseUp

It seems that convert only likes it if the sections are space separated, 
not tab. You also need to be careful about the date format if the 
program is ever going to be used internationally. I always prefer to use 
the English date format for stored data and then convert it to the 
system date format for display. That way the program knows exactly what 
it is dealing with while the user's are comfortable with their display.

Cheers,
Sarah


On Thursday, May 16, 2002, at 02:28  am, Bill Vlahos wrote:

> Sarah,
>
> Any chance I could see your script? I can't seem to get the convert 
> command to work on variables. I have a tab delimited log file in a 
> field with a date stamp followed by a time stamp (24 hour time) and if 
> I concatenate the two items and then convert it simply doesn't do 
> anything. This also fails when trying it in the message box. If I put 
> the actual text it works. If I specify convert to the field it changes 
> the entry in the field (which I don't want to do). If I put the items 
> in a variable it does nothing.
>
> The data looks like this:
> Directory	Dir1-Finger	dir1.jpl.nasa.gov	generic	UP 	5/11/2002	0:0:11	631 
> 631
> Directory	Dir1-Finger	dir1.jpl.nasa.gov	generic	UP 	5/11/2002	0:10:12	602 
> 603
> Directory	Dir1-Finger	dir1.jpl.nasa.gov	generic	UP 	5/11/2002	0:20:12	610 
> 610
>
> Bill
>
> On Tuesday, May 14, 2002, at 05:09  PM, Sarah wrote:
>
>> I had a similar need for charting with a time scale, but Ken's chart 
>> object requires all data to be numeric. I converted all my time stamps 
>> to seconds format so they could be drawn correctly and then edited the 
>> chart script so that when displaying the tick marks on the time axis, 
>> it converts the relevant time stamps back to my preferred date format 
>> for display purposes only.
>>
>> Sarah
>>
>>
>> On Wednesday, May 15, 2002, at 10:04  am, Bill Vlahos wrote:
>>
>>> I'm writing a program to analyze log files and draw charts from the 
>>> data using Ken Simons' excellent object (available from the runrev 
>>> web site).
>>>
>>> The log files are rolled each day so only one day's data is in each 
>>> file and I've been able to easily convert the time of day to decimal 
>>> hours (0 to 24) and plot them. However I want to combine any number 
>>> of day's files and have them represented by a number which makes 
>>> sense.
>>>
>>> To plot the X values in Ken's object all I need to do is provide a 
>>> comma delimited set of numbers and it will take those and plot them.
>>>
>>> Any suggestions?
>>>
>>> Bill Vlahos
>>>
>>> _______________________________________________
>>> use-revolution mailing list
>>> use-revolution at lists.runrev.com
>>> http://lists.runrev.com/mailman/listinfo/use-revolution
>>>
>>
>>
>> _______________________________________________
>> use-revolution mailing list
>> use-revolution at lists.runrev.com
>> http://lists.runrev.com/mailman/listinfo/use-revolution
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>





More information about the use-livecode mailing list