Date Computations
Forum rules
This forum is for discussing APL-related issues. If you think that the subject is off-topic, then the Chat forum is probably a better place for your thoughts !
This forum is for discussing APL-related issues. If you think that the subject is off-topic, then the Chat forum is probably a better place for your thoughts !
16 posts
• Page 1 of 2 • 1, 2
Date Computations
Say you were introducing a new programmer to Dyalog APL. Say he wanted to compute the days difference between two dates, or do various date arithmetic, adding days to a date, etc.
Would you suggest he roll his own functions? Would you point him to a Dyalog library or workspace? Which one? Or to an external library in R or Python?
Would you suggest he roll his own functions? Would you point him to a Dyalog library or workspace? Which one? Or to an external library in R or Python?
- paulmansour
- Posts: 420
- Joined: Fri Oct 03, 2008 4:14 pm
Re: Date Computations
..eh:
#.DateToIDN
#.IDNToDate
-wm
#.DateToIDN
#.IDNToDate
-wm
- Veli-Matti
- Posts: 93
- Joined: Sat Nov 28, 2009 3:12 pm
Re: Date Computations
work on only a single date so require "each" on what is an obvious array problem.Veli-Matti wrote:..eh:
#.DateToIDN
#.IDNToDate
-wm
I'm not suggesting mine are perticularly quick but the same operation using APL on ten thousand dates is seven times as quick.
-
Phil Last - Posts: 628
- Joined: Thu Jun 18, 2009 6:29 pm
- Location: Wessex
Re: Date Computations
When using DateToIDN and IDNToDate, it is worth remembering that these methods are only exposed if root properties are exposed:
Why can't I see Root Methods such as #.DateToIDN?
http://www.dyalog.com/forum/viewtopic.php?f=22&t=161
Or, you can always call these methods like this:
Regards,
Vince
Why can't I see Root Methods such as #.DateToIDN?
http://www.dyalog.com/forum/viewtopic.php?f=22&t=161
Or, you can always call these methods like this:
+2 ⎕nq '.' 'datetoidn' 2018 1 18
43117
Regards,
Vince
- Vince|Dyalog
- Posts: 413
- Joined: Wed Oct 01, 2008 9:39 am
Re: Date Computations
Let's add time to the problem. Say I want to compute the number of seconds elapsed between two time stamps.
My guess is there is no date library, or workspace with an extensive collection of date/time functions. Would that be correct?
My guess is there is no date library, or workspace with an extensive collection of date/time functions. Would that be correct?
- paulmansour
- Posts: 420
- Joined: Fri Oct 03, 2008 4:14 pm
Re: Date Computations
With using .Net I have contributed this to the AplWiki: https://aplwiki.com/netDateTime
-
PGilbert - Posts: 436
- Joined: Sun Dec 13, 2009 8:46 pm
- Location: Montréal, Québec, Canada
Re: Date Computations
Hi Paul,
There is also the dfns.dws days and date dfns.
days ⍝ Day number from ⎕TS format.
date ⍝ ⎕TS format from day number.
Regards,
Vince
There is also the dfns.dws days and date dfns.
days ⍝ Day number from ⎕TS format.
date ⍝ ⎕TS format from day number.
⎕ts
2018 1 18 15 41 4 634
days ⎕ts
43117.65355
⎕ts
2018 1 18 15 41 10 729
days ⎕ts
43117.65361
Regards,
Vince
- Vince|Dyalog
- Posts: 413
- Joined: Wed Oct 01, 2008 9:39 am
Re: Date Computations
paulmansour wrote:My guess is there is no date library, or workspace with an extensive collection of date/time functions. Would that be correct?
That is correct, and it is something we are working on. We've started a project based on the code which is shipped with MiServer https://github.com/Dyalog/MiServer/blob/master/Utils/dates.dyalog but this is somewhat oriented towards the needs of a web application. We would be very happy to receive both code contributions and suggestions for functions which should be in a complete date library.
Our intention is to make libraries of functions for date and string manipulation available on GitHub. Once we have a complete set of functions, we can talk about which parts of it (for example parsing and formatting) which we might want to rewrite in C and include in the interpreter as system functions or similar, for performance reasons.
-
Morten|Dyalog - Posts: 453
- Joined: Tue Sep 09, 2008 3:52 pm
Re: Date Computations
Kai, do you know if anyone uses this library/class?
- paulmansour
- Posts: 420
- Joined: Fri Oct 03, 2008 4:14 pm
16 posts
• Page 1 of 2 • 1, 2
Who is online
Users browsing this forum: No registered users and 1 guest
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group