Getting date from user input.
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Getting date from user input.
Hi,
I need to get dates from user input, but I don't want to use the Datepicker.
So far, I have managed to get the day month and year into a field with two "/" seperators, which gives the appearance of a date, like '23/6/2023'
My problem is that I cannot convert it to seconds in order to subtract the date field from the date in the 'today' field, into which I have 'put the date' (entered today's date).
Is there a way to do this ?
I need to get dates from user input, but I don't want to use the Datepicker.
So far, I have managed to get the day month and year into a field with two "/" seperators, which gives the appearance of a date, like '23/6/2023'
My problem is that I cannot convert it to seconds in order to subtract the date field from the date in the 'today' field, into which I have 'put the date' (entered today's date).
Is there a way to do this ?
Re: Getting date from user input.
Just set the itemdelimiter to / and "swap" the first and second item.
Then you have an english date to let LC work with.
P.S.
Do you know how to do this?
Then you have an english date to let LC work with.
P.S.
Do you know how to do this?
Re: Getting date from user input.
No idea where you are from, but why not work with the date formats in your country?
We have -> the system date etc. in LC!
Example:
I live in germany and -> put the system date gives me: 07.02.23
And I can use this like this:
Just an idea, maybe not working for you...
We have -> the system date etc. in LC!
Example:
I live in germany and -> put the system date gives me: 07.02.23
And I can use this like this:
Code: Select all
convert "07.02.23" from SYSTEM date to seconds
Re: Getting date from user input.
Hi again,
Here's a bit more detail re my problem..
The code is:
Startmth, startday and startyr are user inputs.
In field2 I get '4/3/23 12.00pm'. It looks like a date, but does not convert to seconds, so it cannot be used as a date, to be compared with 'today' to indicate if it is in the future or past.
Here's a bit more detail re my problem..
The code is:
Code: Select all
local tDate, tDate2, tDifference
set the itemdelimiter to "\"
put field "startmth" & "\" & field "startday" & "\" & field "startyr" into field "date1"
put fld "date1" && "12:00 PM" into tdate
convert tdate to seconds
put tdate into fld "field2"
In field2 I get '4/3/23 12.00pm'. It looks like a date, but does not convert to seconds, so it cannot be used as a date, to be compared with 'today' to indicate if it is in the future or past.
Re: Getting date from user input.
Hi, have a look at this thread, see if it helps.
https://forums.livecode.com/viewtopic.p ... er#p196089
https://forums.livecode.com/viewtopic.p ... er#p196089
Andy Piddock
https://livecode1001.blogspot.com Built with LiveCode
https://github.com/AndyPiddock/TinyIDE Mini IDE alternative
https://github.com/AndyPiddock/Seth Editor color theming
http://livecodeshare.runrev.com/stack/897/ LiveCode-Multi-Search
https://livecode1001.blogspot.com Built with LiveCode
https://github.com/AndyPiddock/TinyIDE Mini IDE alternative
https://github.com/AndyPiddock/Seth Editor color theming
http://livecodeshare.runrev.com/stack/897/ LiveCode-Multi-Search
Re: Getting date from user input.
Thanks AndyP for your interest. I don't want to use the Calendar, it's a question of maintaining a consistent presentation. Thanks, anyway..
Re: Getting date from user input.
Many thanks to all - I just realised I was using "/" when it should have been "\".