background preloader

Time

Facebook Twitter

Date Dimensions Part 2 - SQL Server Central. This is the second and last part of the date dimension series. In the first article we discussed how we can add the same dimension into the same cube several times as different names (role play dimension), the advantages and disadvantages of creating several named queries from the same date dimension table, the considerations around the unknown member in the date dimension, and the date hierarchies.

In this article we will discuss: A date dimension that is used as a reference dimensionA date dimension that is generated and stored on the SSAS server (no physical table)Advantages and disadvantages of using smart date key e.g. YYYYMMDDEnabling users to select a date (or month) to be used in calculated measure using 'from date' and 'to date'Other topics about date dimension in SSAS 1. In Figure 1 below, Dim1 and Dim2 are normal dimensions, they are connected to the fact table directly. Figure 1. Figure 2. Option 1. Figure 3. So there are 2 advantages of using a reference dimension: Figure 4. Joda Time - Java date and time API - User Guide. Architecture Overview The major building blocks of joda time are introduced below. These are the concepts of instant, interval, duration, period, chronology and timezones. We then say a few words about the role of interfaces in the library design, which is a little different than the norm.

We end with a few words on package structure. Instants The most frequently used concept in Joda-Time is that of the instant. Within Joda-Time an instant is represented by the ReadableInstant interface. The millisecond instant can be converted to any date time field using a Chronology. We discuss the chronology concept a litte further on in this overview. A companion mutable class to DateTime is MutableDateTime. Other implementations of ReadableInstant include Instant and DateMidnight. Fields The main API of DateTime has been kept small, limited to just get methods for each calendar field. Properties There is much more power available, however, through the use of what is termed a property.

Intervals Periods. Time and Time Again: Concluding Our Extended Taxonomy Discussion. Oracle Date functions and parameters. Oracle Date Functions Version 10.1 Date Current Date SELECT CURRENT_DATE FROM dual; SELECT SYSDATE FROM dual; Current Time SELECT CURRENT_TIME FROM dual; Formats J Julian Date -- Day -- Month -- Year -- Fill Mode Formats That Can Be Used With ROUND And TRUNC Functions - One greater than the first two digits of a four-digit year - Year (rounds up on July 1) - ISO Year - Quarter (rounds up on 16th day of the 2nd month of the quarter) - Month (rounds up on the sixteenth day) - Same day of the week as the first day of the year - Same day of the week as the first day of the ISO year - Same day of the week as the first day of the month - Day - Starting day of the week - Hours - Minute SELECT SYSDATE + 1 FROM dual; SELECT SYSDATE - 1 FROM dual; Add A Month To A Date ADD_MONTHS( , SELECT add_months(SYSDATE, 2) FROM dual; Returns the current date of the server as a value in the Gregorian calendar of datatype DATE col sessiontimezone format a30 SELECT sessiontimezone, current_date FROM dual; SELECT DUMP(SYSDATE) FROM dual; FROM t;

Home [LiquiBase] Traitements temporels en SQL - Cl. La difficulté des calculs portant sur des dates ou des horaires (et parfois les deux) est lié à la codification même de la mesure du temps ainsi qu'au fait que le temps est une entropie (disons le, même une "isentroprie"), c'est à dire qu'il s'écoule de manière uniforme (iso) et dans un seul sens irréversible (vers le futur). La mesure du temps n'obéit pas à des règles conventionnelles, comme le comptage décimal ou l'origine zéro. En effet : Les années comptent tantôt 365 tantôt 366 jours en fait 365 jours 5 heures 48 min. 45,97 sec... Les mois de 29 à 31 jours Il n'y a pas d'année 0, mais il y a des années négatives (avant JC !) Les siècles et millénaires commencent par une année unitaire (1, 1901, 2001...)

Tous ces éléments font que les calculs, notamment de comptage du temps obéissent à des algorithmes complexes. De ce fait, la norme SQL 2, propose une solution générale assez intelligente. Le lundi est considéré comme le premier jour de la semaine. 1.1. La norme propose les types :