Page 1 of 1

The 'convert' command

Posted: Thu Dec 20, 2012 9:38 am
by NigelS
Hi Gang

I really thought I was a clever, now I release I lack a few grey cells or age is causing me to not understand simply english.
For Example the Manual quotes the following to convert a date into seconds to use the following syntax

convert aDate to seconds

my problem is as follows. I have a some data that is inputed as dates. I need to convert these to seconds. I've tried various syntax and just dont seem to come right with it. Below is an example code snippet I've tried.

Code: Select all


 case "DateEntryField"
            if tArrayElement[1] = "ListDateField" then 
               put field "ListDateField" into tDate
               convert tDdate to seconds
               break
            end if


I've tried this as well

Code: Select all


if tArrayelement[1] = "ListingExpiryDateField" then 
               convert field "ListingExpiryDateField" to seconds
               put it into tSeconds
              break
 end if
I've read through the forum and the lessons on RunRev.
What am I missing?

Thanks from a dotting old man.

Re: The 'convert' command

Posted: Thu Dec 20, 2012 11:29 am
by Thierry
Hi dotting old man :)

You better try to check the result after the convert command:

convert <whatever> to seconds
answer the result

I guess you don't have a valid date.

HTH,

Thierry

Re: The 'convert' command

Posted: Thu Dec 20, 2012 11:54 am
by Klaus
Hi Nigel,

if your dates are in correct format you could try to tell Livecode WHAT is going to be converted! 8)
...
convert tDate FROM short date to seconds
### or whatever tDate contains-> system date etc..!
...

Best

Klaus