Hello,
I am trying to create a string like this: 2016-09-07+2016-10-07
And the first date string is 30 days before the second date string.
The date needs to be in this format: 2016-10-07
I can't seem to find a way to get it into this format after using dateitems to perform the calculation for the 30 days prior date.
Any ideas?
Thanks!
Help with date format 2016-10-07
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Re: Help with date format 2016-10-07
Hi RevDev,
1. convert the dateitems back to (system? english?) DATE after your calculation.
2. set the ITEMDELIMITER to SLASH -> /
3. re-create your data to new date format using the three items of the converted date and
4. add leading zeros where neccessary.
Get the picture?
Best
Klaus
1. convert the dateitems back to (system? english?) DATE after your calculation.
2. set the ITEMDELIMITER to SLASH -> /
3. re-create your data to new date format using the three items of the converted date and
4. add leading zeros where neccessary.
Get the picture?
Best
Klaus
-
- VIP Livecode Opensource Backer
- Posts: 7236
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Help with date format 2016-10-07
Here's a start:
Code: Select all
function convertDate pDate
convert pDate to dateitems
set the numberformat to "00"
repeat with x = 1 to 3
put item x of pDate + 0 & "-" after tNewDate
end repeat
return char 1 to -2 of tNewDate
end convertDate
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
-
- Posts: 13
- Joined: Mon Feb 16, 2009 7:39 pm
Re: Help with date format 2016-10-07
Thank you so much for the help! I really appreciate it...
Now I'm off to see if I can get this working.
Now I'm off to see if I can get this working.
Re: Help with date format 2016-10-07
Debrill libdate library is out there for you: https://github.com/derbrill/libdate
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w