Start of a date handling library
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Start of a date handling library
Hi all,
[update]Libdate is now on gitHub
https://github.com/derbrill/libdate
[/update]
as I currently (again) stumbled over the limits of the convert command (on windows no dates before 01/01/1970 can be converted) I started on a small library to handle dates. I will try to attach the stack here.
[update August 01 2014]
I have put quite some work into the lib. There is still quite a bit to do, however it is worth downloading the update:
Handler and Function names have been cleaned up. Also a parser has been added to finally get rid of the convert command as good as possible. I need your help now! I would like to add parsing for as many different languages I can get.
If you are using operating systems set to languages other than english, swedish or german, could you please be so kind to post:
the system dateFormat
the long system dateFormat
the abbrev system dateFormat
the system monthNames
the abbrev system monthNames
the system weekDayNames
the abbrev system weekDayNames
on your machines, along with the language you are using on your system and if possible the ISO code for that language? That would be a great help!
[/update]
[update]
I will always attach the most current version of the library to this post.
June 4th 2013:
New functions added:
libDate_DaysBetween -> returns the number of days between 2 dates
libDate_DateInDaysFrom -> returns the date in a number of days
libDate_DaysOfCalendarWeekIso -> returns the dates in a specific calendar week (ISO Format)
Helper functions:
libDate_DayNumber -> returns a numeric value for a date
libDate_DateFromNumber -> inverse function of the above
[/update]
[update]Libdate is now on gitHub
https://github.com/derbrill/libdate
[/update]
as I currently (again) stumbled over the limits of the convert command (on windows no dates before 01/01/1970 can be converted) I started on a small library to handle dates. I will try to attach the stack here.
[update August 01 2014]
I have put quite some work into the lib. There is still quite a bit to do, however it is worth downloading the update:
Handler and Function names have been cleaned up. Also a parser has been added to finally get rid of the convert command as good as possible. I need your help now! I would like to add parsing for as many different languages I can get.
If you are using operating systems set to languages other than english, swedish or german, could you please be so kind to post:
the system dateFormat
the long system dateFormat
the abbrev system dateFormat
the system monthNames
the abbrev system monthNames
the system weekDayNames
the abbrev system weekDayNames
on your machines, along with the language you are using on your system and if possible the ISO code for that language? That would be a great help!
[/update]
[update]
I will always attach the most current version of the library to this post.
June 4th 2013:
New functions added:
libDate_DaysBetween -> returns the number of days between 2 dates
libDate_DateInDaysFrom -> returns the date in a number of days
libDate_DaysOfCalendarWeekIso -> returns the dates in a specific calendar week (ISO Format)
Helper functions:
libDate_DayNumber -> returns a numeric value for a date
libDate_DateFromNumber -> inverse function of the above
[/update]
- Attachments
-
- libDate.rev.zip
- (8.52 KiB) Downloaded 563 times
Last edited by malte on Wed Apr 01, 2015 11:24 am, edited 4 times in total.
Re: Start of a date handling library
Library attached. It is released into the public domain. No strings attached. No warranty. There is a button to test each function that is implemented. I am looking forward to feedback and contributions if you would like to help out.
Cheers,
Malte
[update] Updated the library. You can find it below[/update]
Cheers,
Malte
[update] Updated the library. You can find it below[/update]
Last edited by malte on Sat Jun 29, 2013 8:25 pm, edited 1 time in total.
Re: Start of a date handling library
Hi Malte!
Thanks for this fine contribution to the community! It is something much needed.
All the best!
Mats
Thanks for this fine contribution to the community! It is something much needed.
All the best!
Mats
http:www.tapirsoft.on-rev.com
Open Source LiveCode Plugins - rIDE, rGrid, rTree
LiveCode projects
Open Source LiveCode Plugins - rIDE, rGrid, rTree
LiveCode projects
-
- VIP Livecode Opensource Backer
- Posts: 4013
- Joined: Sun Jan 07, 2007 9:12 pm
- Location: Bochum, Germany
Re: Start of a date handling library
Hi Malte,
thank you very much for sharing, very useful.
Finally I know that I was born on the 190th day in isoCalenderweek 27.
One little problem.
you have two buttons "libDate_AbbrevSystemWeekdayName" the first one throws an error because of "libDate_CalendarWeek" there is no handler for this call. What did you want to do there?
Kind regards
Bernd
thank you very much for sharing, very useful.
Finally I know that I was born on the 190th day in isoCalenderweek 27.
One little problem.
you have two buttons "libDate_AbbrevSystemWeekdayName" the first one throws an error because of "libDate_CalendarWeek" there is no handler for this call. What did you want to do there?
Kind regards
Bernd
Re: Start of a date handling library
Ah, drats. That one is a leftover. I first wanted to call the funcion libDate_CalendarWeek, but that would be misleading, as in the US the calendar week is counted differently. So I added the ISO Postfix and forrgot to throw out the button.
What I plan now is to have a set of handlers for converions between dates and for date validation. This is really just a first step, but thee is a couple of things I need which might Predate 1970 or Postdate 2035, so I can not rely on the convert command.
Best,
Malte
What I plan now is to have a set of handlers for converions between dates and for date validation. This is really just a first step, but thee is a couple of things I need which might Predate 1970 or Postdate 2035, so I can not rely on the convert command.
Best,
Malte
Re: Start of a date handling library
Hi Malte,
I am checking this out in LC Community 6.1 (dp2)
Checked each button and the dates work great! Nice having dates that go further back in time.
Your buttons - there are two buttons that state libDate_AbbrevSystemWeekdayName - from the top down: the first button throws this error:
button "libDate_AbbrevSystemWeekdayName": execution error at line 6 (Function: error in function handler) near "libDate_CalendarWeek", char 8
The second one or bottom one works fine!
cheers,
Scott
I am checking this out in LC Community 6.1 (dp2)
Checked each button and the dates work great! Nice having dates that go further back in time.
Your buttons - there are two buttons that state libDate_AbbrevSystemWeekdayName - from the top down: the first button throws this error:
button "libDate_AbbrevSystemWeekdayName": execution error at line 6 (Function: error in function handler) near "libDate_CalendarWeek", char 8
The second one or bottom one works fine!
cheers,
Scott
spookaw
-
- VIP Livecode Opensource Backer
- Posts: 129
- Joined: Sun Feb 20, 2011 4:26 pm
- Location: Vancouver Island, BC, Canada. ex.UK
- Contact:
Re: Start of a date handling library
Thown out the extra button and it works great.
Thank you very much for sharing.
Paul
Thank you very much for sharing.
Paul
Re: Start of a date handling library
thanks for the feedback guys. So what else is needed. I want to write conversion routines to transform dates from one date into another. This will be tricky to come up with proper syntax though. Any suggestions very welcome.
Best,
Malte
Best,
Malte
Re: Start of a date handling library
Mats just reported an error. short english returned the long format. This is now fixed. The extra button has been removed. The update is attached to the first post of this thread.
Cheers,
malte
Cheers,
malte
-
- VIP Livecode Opensource Backer
- Posts: 7257
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Start of a date handling library
Very cool Malte, thanks much. I didn't know I was born on a Thursday until now.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
-
- Livecode Opensource Backer
- Posts: 33
- Joined: Tue Apr 17, 2012 9:50 am
- Location: SAINT NAZAIRE FRANCE
Re: Start of a date handling library
Hello Malte,
Thank you for libDate, very useful and simple to use. Work fine.
Warms Regards
Eric
Thank you for libDate, very useful and simple to use. Work fine.
Warms Regards
Eric
-
- VIP Livecode Opensource Backer
- Posts: 858
- Joined: Wed Jun 24, 2009 1:17 pm
- Location: Plymouth, UK
- Contact:
Re: Start of a date handling library
Hi Malte
Very nice, thanks for sharing - have discovered my wife and I were both born on a Thursday
Very nice, thanks for sharing - have discovered my wife and I were both born on a Thursday
"...this is not the code you are looking for..."
Re: Start of a date handling library
Glad to hear it is useful. What else do you all think is needed?
Re: Start of a date handling library
Hi Malte!
I would love to have a weekDates function, returning the dates of a week. It would simplify building a month view a great deal.
Thanks again for this fine lib!
Best
Mats
I would love to have a weekDates function, returning the dates of a week. It would simplify building a month view a great deal.
Thanks again for this fine lib!
Best
Mats
http:www.tapirsoft.on-rev.com
Open Source LiveCode Plugins - rIDE, rGrid, rTree
LiveCode projects
Open Source LiveCode Plugins - rIDE, rGrid, rTree
LiveCode projects
Re: Start of a date handling library
Hey Mats,
what would you like as a return value?
Best,
Malte
what would you like as a return value?
Best,
Malte