In a first blog post regarding conversions in SAP Gateway Foundation we discussed their relevance in the context of the differences between the ABAP type system and the OData type system. Although not directly related to conversions the handling of date and time perfectly fits into this topic.
ABAP knows date, time, and different representations of time stamps. And, it provides reuse functions to execute date and time calculations. OData has its own date and time definitions with functions that may be used in
$filter
expressions, for example.
Often, questions arise how the different representations map and how a data provider needs to be implemented to create a best match between both worlds. It is certainly not possible to dig into each and every detail. But, let us start with a few aspects.
Date and Time in OData
To represent date and time information, the OData specification in version 2.0 knows the three primitive types
-
Edm.DateTime,
-
Edm.Time, and
-
Edm.DateTimeOffset.
Since this is not really sufficient for business applications specification version 4.0 switches to
-
Edm.Date,
-
Edm.TimeOfDay,
-
Edm.DateTimeOffset, and
-
Edm.Duration.
We focus on specification version 2.0 and restrict the discussion to Edm.DateTime and Edm.DateTimeOffset. Details regarding the representations can be found in the
OData specification
, the
ISO 8601 standard
, and in
http://www.w3.org/TR/xmlschema-2
. Here, we quickly list the different formats. The literals are used in the URI, that is, in
$filter
expressions or key predicates, for example. ATOM and JSON refer to the content type of the request or response payload. The number of decimal places available for sub-seconds is defined by the facet precision.
Edm.DateTime represents a date and a time in
UTC
(formerly, Greenwich Mean Time):
|
|
Representation
|
Example
|
|
Literal
|
datetime'yyyy-mm-ddThh:mm[:ss[.fffffff]]'
|
datetime'2016-07-08T12:34:56'
|
|
ATOM
|
yyyy-mm-ddThh:mm[:ss[.fffffff]]
|
2016-07-08T12:34:56
|
|
JSON
|
"\/Date(<ticks>)\/"<ticks> = number of milliseconds since midnight Jan 1, 1970
|
"\/Date(1467981296000)\/"
|
The ticks in the JSON representation may also be negative to describe dates and time before Jan 1, 1970. "\/Date(-6847804800000)\/" is midnight Jan 1, 1753, for example.
Edm.DateTimeOffset adds time zone information relative to UTC. The date and time information is amended by the standard time difference (offset) with the sign
v
: +01:00 for Central European Time (CET) or -05:00 for Eastern Standard Time (EST), for example.
|
|
Representation
|
Example
|
|
Literal
|
datetimeoffset'yyyy-mm-ddThh:mm:ss[.fffffff]Z|vii:nn'
|
datetimeoffset'1970-01-01T00:00:01+01:00'
|
|
ATOM
|
yyyy-mm-ddThh:mm:ss[.fffffff]Z|vii:nn
|
1970-01-01T00:00:01+01:00
|
<
Pedro Pascal
Se unió el 07/03/2018
Facebook
Pinterest
Telegram
Linkedin
Whatsapp
No hay respuestas para mostrar
Se el primero en responder
PARA MÁS INFORMACIÓN
INGRESA TUS DATOS
Preguntas más populares
-
Cálculos MTD, YTD e YTG em Relatórios de Análise para o Ano Atual: Funcionalidades e Exemplos
Como em outros cálculos, MTD, YTD e YTG (no caso de dados de previsão) são cálculos comumente necessários, especialmente quando temos que usar dimensões de tempo como Ano/Mês (Períodos Fiscais)....
01/03/2024 ·
9K+ Vistas ·
0 Respuestas
-
Cómo modificar un archivo .apk existente: Guía paso a paso
Hoy me gustaría compartir contigo mis descubrimientos sobre cómo se puede modificar un archivo .apk existente.
Un archivo .apk representa la aplicación móvil tal como está ins...
01/03/2024 ·
29K+ Vistas ·
1 Respuestas
-
Cómo evitar y solucionar java.lang.NullPointerException en Java
Hola a todos,
¿Alguien puede decirme sobre java.lang.NullPointerException?
Cuándo recibiremos este tipo de error y cómo solucionarlo.
Si obtenemos este error, ¿dónde debemo...
01/03/2024 ·
26K+ Vistas ·
4 Respuestas
-
Cómo crear una función web para activar un paquete de información en un entorno BPS y SEM-BCS
Hola,
En nuestro entorno de BPS solo estamos utilizando funcionalidades web para ingresar datos. Ahora tengo que crear una función web para activar un paquete de información, que coloca lo...
01/03/2024 ·
193 Vistas ·
3 Respuestas
-
¿Cómo verificar si mi sistema es de 32 bits o 64 bits? Métodos y consejos
Hola expertos,
¿Cómo puedo verificar si mi sistema es de 32 bits o de 64 bits?
Si tienen algún documento relacionado con esto, por favor proporcionenlo.
Gracias
01/03/2024 ·
15K+ Vistas ·
4 Respuestas
contacto@primeinstitute.com
(+51) 1641 9379
(+57) 1489 6964
© 2026 Copyright. Todos los derechos reservados.
Desarrollado por Prime Institute
Hola ¿Puedo ayudarte?