date format

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
link76
Posts: 99
Joined: Fri Nov 04, 2011 1:52 pm

date format

Post by link76 » Mon Mar 03, 2014 12:34 pm

Hello,

I would like to convert this date: 7-2-2014 >> 7-Feb-2014:

Code: Select all

put "7-2-2014" into tDate
set itemdelimeter "-"
put datefunction (%B, item 2 of tDate........ 
thank you

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

Re: date format

Post by Klaus » Mon Mar 03, 2014 12:52 pm

Hi link76,

there is no build-in function to deal with this date format, so you need to make your own.

Quick shot:
...
put "7-2-2014" into tDate
set itemdelimeter "-"

## Since it looks like you only need the abbreviated month name, you can do something like this:
## 1. get the month NUMBER from the date:
put item 2 of tDate into tMonth

## 2. Now use the bulid-in "monthnames" function:
put the line tMonth of the abbr monthnames into item 2 of tDate
## tDate = 7-Feb-2014 :D
## Done!
...

Best

Klaus

Post Reply