Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!
set the itemdelimiter to "/"
put field "startday" & "/" & field "startmth" & "/" & field "startyr" into fld "announce8"
put field "startmth" & "/" & field "startday" & "/" & field "startyr" into date1
put field "startmth" & "/" & field "startday" & "/" & field "startyr" into date2
convert date1 to long date
field "announce8" is "11/5/25".
The problem is that I cannot get that date into seconds, to enable further scripting.
Is it possible to convert date1 or fld "announce8 into seconds ?
set the itemdelimiter to "/"
put field "startday" & "/" & field "startmth" & "/" & field "startyr" into fld "announce8"
put field "startmth" & "/" & field "startday" & "/" & field "startyr" into date1
put field "startmth" & "/" & field "startday" & "/" & field "startyr" into date2
put fld "announce8" into tDate
convert tDate to seconds
answer tDate & "27"
and this gives me 05/11/2025 27
It looks like fld "announce8" is not recognised as a date.
put fld "startmth" into smth
put fld "startday" into sday
put fld "startyr" into syr
set the itemdelimiter to "/"
put smth & "/" & sday & "/" & syr into tdate
#put field "startmth" & "/" & field "startday" & "/" & field "startyr" into tDate
convert tDate to seconds
answer tDate & "27"
Not that your sample code shows a date that would encounter a problem, but on Windows anything before 1970 is not recognised as a date. A disappointingly ignored problem since forever.
Thanks all of you for your interest and insights.
Jacque, I used your suggestion and it works ! Thank you so much for that little wheeze.
So now I can move forward.
Could you please tell us what this info (usesystemdate) actually changed for you?
Your examples here did not give any clue that you are NOT using an english date -> 05/11/2025
Heh, I don't think that was the fix, jwack said to put word 1 of each field into the relevant item of the date to be converted (which woild strip any whitespace/extraneous characters).
Which implies that the original contents of the field were not "clean" values within range/devoid of extra characters.
Lesson = check the input data.