1.日期类型(D,Date)
在sap里Date类型通过隐含的转换函数变为CHARACTER*8.
Elementary data type = D 内部长度和 输出长度都等于8
System data type = DATS 内部长度 = 8 输出长度 = 10
所有的日期类型在sap里都会通过转换函数存为 'YYYYMMDD'格式.
Most of the times both type 'D' and 'DATS' behaves similarly except when they are output without any overriding additions. In such cases a 'DATS' type variable will be output with separators as specified in the "Date Format Settings" while a type 'd' variable will be output without separators.

输出格式:输出格式可以有三种方法设置:

1. 用户设定 - Transaction SU3
a. 设置用户参数
2. 本地/国家格式日期设定 - Transaction OY01
a. 先使用SET COUNTRY <xx> or SET LOCALE COUNTRY <xx>命令, 在调用输出显示.
3. 直接使用 "WRITE' 的格式
a. DD/MM/YY
b. MM/DD/YY
c. DD/MM/YYYY
d. MM/DD/YYYY
e. DDMMYY
f. MMDDYY
g. YYMMDD
h. USING EDIT MASK '==SDATE' -value checked for validity
i. USING EDIT MASK '==LDATE' -value checked for validity

2.时间(Time)

在sap里Time类型通过隐含的转换函数变为CHARACTER*6.
Elementary data type = T 内部长度和 输出长度都等于 6
System data type = TIMS 内部长度 =6  输出长度都等于= 8
所有的时间类型在sap里都会通过转换函数存为 'HHMMSS'格式.
Most of the times both type 'T' and 'TIMS' behaves similarly except when they are output without any overriding additions. In such cases a 'TIMS' type variable will be output with separators as specified (HH:MM:SS) while a type 'T' variable will be output without separators.

Working with Timestamp
An extension of the DATE data type that can store date and time data (including fractional seconds).

The ABAP Dictionary contains the data elements TIMESTAMP, TIMESTAMPL,

TIMESTAMP = P(8) Decimal 0
TIMESTAMPL = P(11) Decimal 7 ( decimal for fraction of second)

Commands
GET TIME: Places the current time in the system field SY-UZEIT. At the same time, SY-DATUM is set, and the system fields for the local time zone (SY-TIMLO,SY-DATLO, and SY-ZONLO) are refreshed.

GET TIME STAMP FIELD <F> Returns the timestamp in short or long form. The short form contains the current date and time; the long form also contains seven decimal places for fractions of a second, making the timestamp accurate to within 100 nanoseconds.

Time Zone
the world is divided into 24 time zones spaced at intervals of 15 degrees in longitude. The zones start at 0 with Greenwich. Within each time zone, the hour and minute of the day is defined to be the same. Time zones are usually specified by the number of hours they differ from GMT

TTZCU Customizing time zones table.

DST : Daylight Saving Time gives us the opportunity to enjoy sunny summer evenings by moving our clocks an hour forward in the spring.

Note :
Simple write statement is not going to put Timestamp in the desired output format. One has to specify a TIME ZONE for output formatting.

Transaction STZBD维护时区.
1. TTZZ : Time zones
2. TTZR : Time zone rules
3. TTZD : Summer time rules (Daylight saving).
4. TTZDF : Summer time rules (fixed annual dates)
5. TTZDV : Summer time rules (variable dates)

日期时间相关的系统变量
1. SY-TZONE Date and time, time difference from Greenwich Mean Time.
2. SY-DATUM Date and time, current (application server) date.
3. SY-UZEIT Date and time, current application server time.
4. SY-ZONLO Date and time, time zone of user.
5. SY-DATLO Date and time, local date of user.
6. SY-TIMLO Date and time, local time for user.

Time Stamp转换
CONVERT TIME STAMP tst
TIME ZONE tz
INTO DATE d
TIME t [DAYLIGHT SAVING TIME dst].

CONVERT DATE d
TIME t [DAYLIGHT SAVING TIME dst]
INTO TIME STAMP tst
TIME ZONE tz.

The time stamp tst is always UTC time while d and t are always based on the time zone tz.The system always converts using the difference between the timezone tz and UTC time.

This implies that if you want to convert between non-UTC time zones then you can use the above statements in conjunction, First convert date & time in time zone 1 into UTC time stamp and then convert the UTC time stamp into date & time in time zone 2.  

转载于:https://www.cnblogs.com/xiaomaohai/archive/2006/11/17/6157466.html

关于sap的日期,时间相关推荐

  1. oracle 日期 extract,ORACLE——EXTRACT() 截取日期时间的函数使用

    1.截取日期的 年: --使用方法 EXTRACT(YEAR FROM DATE) SQL> SELECT EXTRACT( YEAR FROM SYSDATE ) FROM DUAL; --结 ...

  2. SAP UI5日期字段的显示逻辑和用法

    Sent: Tuesday, December 23, 2014 2:27 PM 这里是Opportunity Notes UI上Date Format的逻辑: <FeedListItem se ...

  3. MySQL 学习笔记(12)— 数据类型(定长字符、变长字符、字符串大对象、数字类型、日期时间类型、二进制类型)

    MySQL 常见的数据类型有字符串类型.数字类型.时间类型.二进制类型.具体的分类如下图: 1. 字符串类型 字符串类型用于存储字符和字符串数据,主要包含三种具体的类型:定长字符串.变长字符串以及字符 ...

  4. MySQL 学习笔记(3)— 字符串函数、数值函数、日期时间函数、流程函数、聚集函数以及分组数据

    1. 字符串函数 MySQL 的常用函数包括字符串函数.数值函数.日期时间函数.流程函数等. SELECT ascii("abc"),char(97),concat("h ...

  5. java时间转换为字符串格式错误_字符串转换为日期时间格式及其错误处理(转)

    1. 字符串转换成日期时间格式 //日期时间格式:yyyy-MM-dd hh:mm:ss String time ="1900-02-21 12:23:33"; //将字符串转换为 ...

  6. PHP 中日期时间函数 date() 用法总结

    [导读] date()是我们常用的一个日期时间函数,下面我来总结一下关于date()函数的各种形式的用法,有需要学习的朋友可参考.格式化日期date() 函数的第一个参数规定了如何格式化日期 时间.它 ...

  7. 语言 全排列 函数_Power Query 中日期时间格式转换需要了解的区域语言对照表

    不同的国家有不同的日期时间书写格式,比如: 多数亚洲国家:yyyy-MM-dd hh:mm 有些欧洲国家:dd.MM.yyyy HH:mm 极少数的国家:MM/dd/yyyy h:mm tt 还有各种 ...

  8. mysql 日期时间格式化字符串_MySQL日期函数与日期转换格式化函数大全

    Mysql作为一款开元的免费关系型数据库,用户基础非常庞大,本文列出了MYSQL常用日期函数与日期转换格式化函数 1.DAYOFWEEK(date) SELECT DAYOFWEEK('2016-01 ...

  9. 把字符串转换为日期时间

    有一字符串"2013080117041122"需要转换为日期时间. Insus.NET在MSDN找到一个方法,就是DateTime.ParseExact,它是可以把一个字符串转换为 ...

  10. java8日期加本地,日期时间API(JDK8新增)

    日期时间API(JDK8新增) JDK8出现之前 JDK8新时间日期API LocalDate.LocalTime.LocalDateTime 的使用 类似于Calendar LocalDateTim ...

最新文章

  1. java字典写实例,基于JAVA的新华字典接口调用代码实例
  2. python 登陆开心网图片批量下载-selenium实现
  3. MYSQL数据库命名及设计规范
  4. 编程小白的第一本python入门书-《编程小白的第一本Python入门书》读书笔记
  5. mysql 迭代更新_MySQL、MongoDB、Redis 数据库之间的区别与使用(本章迭代更新)
  6. STM32开发 -- 4G模块开发详解(2)
  7. C语言 | 编程实现3
  8. matlab填充点面,求大神指点绘制空间内散点图的包络面,,,散点程序如下
  9. python stdin和stdout_stdin似乎比stdout(python)慢得多.为什么?
  10. java linux 当前路径_Java,Linux文件路径
  11. detected idea启动 web_IDEA使用Tomcat服务器出现乱码问题排查过程
  12. 51NOD 1185 威佐夫游戏 V2(威佐夫博弈)
  13. Server Application Error(IIS)
  14. 计算机cad查询,电脑端如何快速查阅CAD图纸
  15. 审计人员需要哪些计算机知识,审计人员应具备的知识与技能
  16. 纯css画三角形/梯形(兼容ie6)
  17. HML_FwLib_8051使用补充说明
  18. DedeCMS帝国备份王织梦系统网站搬家
  19. 稳压二极管工作原理、重要参数意义和典型电路参数计算
  20. java条码扫描_Java上的条形码扫描仪实现

热门文章

  1. 修改Linux用户的UID、GID
  2. 核心动画(Core Animation)简介及常规用法
  3. Contact Manager Web API 示例[1]CRUD 操作
  4. C++多线程编程 (1)
  5. c++学习笔记(5)
  6. Jmeter系列之数据库操作
  7. 12个写论文必备的神经网络可视化工具
  8. 今日恐慌与贪婪指数为70 贪婪程度有所缓解
  9. “北京链安”近日更名为“中科链安”
  10. Filecoin Gas基础费率跌至4.40 nanoFIL