Date problem

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
CAsba
Posts: 364
Joined: Fri Sep 30, 2022 12:11 pm

Date problem

Post by CAsba » Fri Sep 08, 2023 10:59 am

Hi, I want to add one year to the current date and display it.
I tried

Code: Select all

put the date into tDate
   convert tDate to dateItems
   add 1 to item 1 of tdate
   convert tdate to abbrev date
   put abbrev date into fld "date" 
but all I got was today's (unchanged) date.
Any ideas why it didn't add the year to the abbrev date - it added it to the tdate before converting to abbrev date.

Klaus
Posts: 13829
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Date problem

Post by Klaus » Fri Sep 08, 2023 11:04 am

Hi CAsba,

the last line is the culprit!
"the abbr date" will give you AGAIN the current date, but you want the vonverted content of tDate:

Code: Select all

put the date into tDate
convert tDate to dateItems
add 1 to item 1 of tdate
convert tdate to abbrev date
## put abbrev date into fld "date"
put tDate into fld "date" 
Best

Klaus

CAsba
Posts: 364
Joined: Fri Sep 30, 2022 12:11 pm

Re: Date problem

Post by CAsba » Fri Sep 08, 2023 11:11 am

Many thanks Klaus !

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”