Format Date dd/mm/yyyy in objet field

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!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
jgayoso
Posts: 13
Joined: Fri Jan 26, 2018 3:25 pm

Format Date dd/mm/yyyy in objet field

Post by jgayoso » Sat Feb 17, 2018 7:42 pm

If I enter the date 02/13/2018 the validation gives OK, but if I enter 13/02/2018 the validation is invalid date.
.
if field "field_date" is not date then
answer "fecha invalida"
else
answer "Fecha OK"
end if

How do I enter DD / MM / YYYYY and validate OK?

Thank you for any help.

Jorge Gayoso
Chile

SparkOut
Posts: 2834
Joined: Sun Sep 23, 2007 4:58 pm

Re: Format Date dd/mm/yyyy in objet field

Post by SparkOut » Sat Feb 17, 2018 7:54 pm

If your regional settings are set for DD/MM/YYYY format then you can

Code: Select all

set the useSystemDate to true
This will need to be reset for each script that uses date functions and will unset itself at the end of the script. On Windows, please note that a date before 01/01/1970 will not validate at all, regardless of the system date settings.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9567
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Format Date dd/mm/yyyy in objet field

Post by dunbarx » Sat Feb 17, 2018 10:52 pm

What Sparkout said.

Just for grins, know that on a Mac (of course) a wider range of prehistory is available.

viewtopic.php?f=9&t=26619&p=138530&hili ... ng#p138530

Craig Newman

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Format Date dd/mm/yyyy in objet field

Post by bogs » Sat Feb 17, 2018 10:54 pm

SparkOut wrote:
Sat Feb 17, 2018 7:54 pm
On Windows, please note that a date before 01/01/1970 will not validate at all, regardless of the system date settings.
couldn't you just grab the seconds since then, and convert it to date?

*Edit - On reflecting about it a bit more, I think I'd use the date function, then put the items in whatever order I needed them to show up.
Image

jgayoso
Posts: 13
Joined: Fri Jan 26, 2018 3:25 pm

Re: Format Date dd/mm/yyyy in objet field

Post by jgayoso » Sun Feb 18, 2018 1:22 am

SparkOut , thank you.

Greetings from the south of the world.

Jorge Gayoso

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”