The 'convert' command

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
NigelS
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 83
Joined: Sat Oct 22, 2011 2:37 pm

The 'convert' command

Post by NigelS » Thu Dec 20, 2012 9:38 am

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.

Thierry
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 875
Joined: Wed Nov 22, 2006 3:42 pm

Re: The 'convert' command

Post by Thierry » Thu Dec 20, 2012 11:29 am

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
!
SUNNY-TDZ.COM doesn't belong to me since 2021.
To contact me, use the Private messages. Merci.
!

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: The 'convert' command

Post by Klaus » Thu Dec 20, 2012 11:54 am

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

Post Reply