Which column type should be used to store a periodicity in Oracle?
Daily: time, e. g. "14:00"
Weekly: day of week, time, e. g. "Mon 14:00"
Monthly: day of month, time, e. g. "24 14:00"
Yearly: month, day, time, e. g. "12-24 14:00"
Week of year: calendar week, day, time, e. g. "W01 Mon 14:00"
Especially because of the calendar week I guess storing a pattern as text in ISO 8601 format could work. Or is there a better solution that works e. g. on timestamps?
The intent is only to store a pattern in the database. This pattern will then be used to create a periodicity for dates in a given time interval.
Example using Jodatime in Java:
Start DateTime: 2017-01-01
End DateTime: 2017-01-03
Periodicity: Daily, 02:00 - 06:00
(this is what my question is about, i. e. how to store it)
In Java the following intervals will be created using these data, the created intervals will not be stored in the database, they'll be only processed:
2017-01-01 02:00 - 2017-01-01 06:00
2017-01-02 02:00 - 2017-01-02 06:00
Related
I'm struggling with a formula where I have to calculate whether a person's absence time is hours or days. The normal formula works but when I change it to ARRAY it doesn't work anymore
data1
Data 2
note
01/01/2021 08:00:00
01/01/2021 09:10:00
only hour
04/01/2021 08:00:00
09/01/2021 08:00:00
days
normal formula:
=IF(IF(AND(DAY(D2)=DAY(E2);MONTH(D2)=MONTH(E2));1;0)=1;(HOUR(E2)-HOUR(D2))/10;DATEDIF(D2;E2;"d"))
array formula
=ArrayFormula(IF(IF(AND(DAY(D2:D)=DAY(E2:E);MONTH(D2:D)=MONTH(E2:E));1;0)=1;(HOUR(E2:E)-HOUR(D2:E))/10;DATEDIF(D2:D;E2:E;"D")))
example link
https://docs.google.com/spreadsheets/d/1EFxugOajxOAEDUgJQEalOXVpKrFwEm2YWSK_N2hq4gw/edit?usp=sharing
I have a database of time's that are not necessarily exact to the specified time. For example, if I want to pick 12:00 PM and my columns have times in column A:
[9:00 AM, 11:55 AM, 2:00 PM, 6:00 PM],
The closest before would be 11:55 AM, and closest after would be 2:00 PM. My attempt at the code:
=MAXIF(A:A, A:A, 12:00)
=MINIF(A:A, A:A, 12:00)
But to no avail, anythoughts?
You want the max where the time is less than or equal to the criteria and the Min for the time greater than or equal to the criteria:
=MAXIFS(A:A, A:A,"<=12:00")
=MINIFS(A:A, A:A,">=12:00")
Date.new results in # -4712-01-01.
Just as per the title, what logic am i missing, why start from -4712?
https://en.wikipedia.org/wiki/Julian_day
The Julian Period is a chronological interval of 7980 years beginning 4713 BC. It has been used by historians since its introduction in 1583 to convert between different calendars. 2015 is year 6728 of the current Julian Period. The next Julian Period begins in the year 3268 AD.
The internal representation of a Date or DateTime object is an astronomical Julian date: a fractional number of days since a "time zero" in 4712 BCE.
More information are also available in the Ruby documentation for Date.
The Julian day number is in elapsed days since noon (Greenwich mean time) on January 1, 4713 BCE (in the Julian calendar).
In this document, the astronomical Julian day number is same as the original Julian day number. And the chronological Julian day number is a variation of the Julian day number. Its days begin at midnight on local time.
From Wikipedia
The Julian day number can be calculated using the following formulas (integer division is used exclusively, that is, the remainder of all divisions are dropped):
The months (M) January to December are 1 to 12. For the year (Y) astronomical year numbering is used, thus 1 BC is 0, 2 BC is −1, and 4713 BC is −4712. D is the day of the month. JDN is the Julian Day Number, which pertains to the noon occurring in the corresponding calendar date.
What is the extra data included in a date object? Given the following example:
time = Time.at(1392328830)
# => 2014-02-13 15:00:30 -0700
date = time.to_date
# => #<Date: 2014-02-13 ((2456702j,0s,0n),+0s,2299161j)>
What does all this represent? It's not clear from looking at the Ruby Date documentation.
((2456702j,0s,0n),+0s,2299161j)
What you're seeing is the output from Object.inspect which is a human-readable representation of an object. In the case of the Date class:
From date.rb:
# Return internal object state as a programmer-readable string.
def inspect() format('#<%s: %s,%s,%s>', self.class, #ajd, #of, #sg) end
# Return the date as a human-readable string.
#
# The format used is YYYY-MM-DD.
def to_s() strftime end
The instance variables are:
#ajd is an Astronomical Julian Day Number
#of is an offset or fraction of a day from UTC
#sg is the Day of Calendar Reform
But what do these terms mean?
1. What is an Astronomical Julian Day Number? (#ajd)
For scientific purposes, it is convenient to refer to a date simply as a day count, counting from an arbitrary initial day. The date first chosen for this was January 1, 4713 BCE. A count of days from this date is the Julian *Day* Number or Julian *Date*. This is in local time, and counts from midnight on the initial day. The stricter usage is in UTC, and counts from midday on the initial day. This is referred to in the Date class as the Astronomical *Julian* Day *Number*. In the Date class, the Astronomical Julian Day Number includes fractional days.
2. Offset from what? (#offset)
Time zones are represented as an offset from UTC, as a fraction of a day. This offset is the how much local time is later (or earlier) than UTC. UTC offset 0 is centered on England (also known as GMT). As you travel east, the offset increases until you reach the dateline in the middle of the Pacific Ocean; as you travel west, the offset decreases.
3. What is the Day of Calendar Reform? (#sg)
The Gregorian Calendar was introduced at different times in different regions. The day on which it was introduced for a particular region is the Day *of* Calendar *Reform* for that region. This is abbreviated as sg (for Start of Gregorian calendar) in the Date class.
From what I can tell, the Gregorian Calendar is calendar that self-corrects via leap years.
i need a correct weekly ISO 8601 recurring time interval.
For example, repeat:
Each Monday, 19:00.
I already tried a lot of examples, but nothing worked correctly :-(
Thx for any help!
R/2014-W01-1T19:00:00/P1W
Represents a unbounded recurrence with a start date and a duration of one week. The recurrence starts at the first day (Monday) of the week number 01 in the week year 2014. I have used a week date, but you can substitute it with a calendar date or ordinal date, just make sure the date falls on a Monday.