当前位置:网站首页>SAP ui5 date type sap ui. model. type. Analysis of the display format of date
SAP ui5 date type sap ui. model. type. Analysis of the display format of date
2022-07-04 11:57:00 【Wang Zixi】
I developed a SAP UI5 application , Data type used sap.ui.model.type.Date
, And specify the display format pattern
by :yyyy-MM-ddTHH:mm:ss
:
<ObjectAttribute title="{i18n>dateTitle}" text="{ path: 'invoice>ShippedDate', type: 'sap.ui.model.type.Date', formatOptions: { style: 'long', source: { pattern: 'yyyy-MM-ddTHH:mm:ss' } } }"/>
The value of the data source bound to this field is :2015-04-01T01:20:59
I look forward to SAP UI5 The format displayed on the is One year - a certain month - One day -T- Hours - branch - second
, But the final display effect is shown in the figure below :April 1,2015
This article introduces how to analyze the problem of this display format .
In the previous article , We have ruled out that this problem is caused by data parsing errors , Because in DateFormat.js
Of _format Method input parameters oJSDate
, It has been possible to observe correctly from the local JSON The file parsed contains Hours , branch , second
Time value of :Thu Apr 02 2015 01:20:30 GMT+0800 (China Standard Time)
this.aFormatArray
Only five records are included , Excluding hours , branch , second , Therefore, the last output time is only mm / DD / yyyy .
analysis aFormatArray
Data source :
this.aFormatArray = this.parseCldrDatePattern(this.oFormatOptions.pattern);
Run time debugging :this.oFormatOptions.pattern The value of is MMddyyyy
We are xml Specified in the view pattern, Can be in callstack See in :
XML View address , be located One suit SAP UI5 Step by step learning tutorials for developers Step No 34:
pattern: ‘yyyy-MM-ddTHH:mm:ss’
We xml The view only provides source-pattern, instead of pattern, therefore ,SAP UI5 frame , You need to call the following code to generate pattern:
oFormat.oFormatOptions.pattern = oInfo.getPattern(oFormat.oLocaleData, oFormat.oFormatOptions.style, oFormat.oFormatOptions.calendarType);
from SAP UI5 Generate Pattern
To see , We xml Provided in the view pattern Not considered as an input parameter :
getDatePattern: function(sStyle, sCalendarType) {
assert(sStyle == "short" || sStyle == "medium" || sStyle == "long" || sStyle == "full", "sStyle must be short, medium, long or full");
return this._get(getCLDRCalendarName(sCalendarType), "dateFormats", sStyle);
},
style Support full, And what I specified was long
.
If I set it to full, The display effect is as follows :Thursday, April 2, 2015
more Jerry The original article of , All in :“ Wang Zixi ”:
边栏推荐
- Snowflake won the 2021 annual database
- Sys module
- Dos and path
- 3W word will help you master the C language as soon as you get started - the latest update is up to 5.22
- Take advantage of the world's sleeping gap to improve and surpass yourself -- get up early
- SSH原理和公钥认证
- Shift EC20 mode and switch
- Attributes and methods in math library
- Climb Phoenix Mountain on December 19, 2021
- (August 10, 2021) web crawler learning - Chinese University ranking directed crawler
猜你喜欢
OSI seven layer reference model
Alibaba cloud server connection intranet operation
Usage of case when then else end statement
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 11
Games101 Lesson 8 shading 2 Notes
Analysis function in SQL
Entitas learning [3] multi context system
(2021-08-20) web crawler learning 2
Introduction of network security research direction of Shanghai Jiaotong University
TCP slicing and PSH understanding
随机推荐
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 23
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 13
Realize cross tenant Vnet connection through azure virtual Wan
Reptile learning 3 (winter vacation learning)
thread
os. Path built-in module
Usage of case when then else end statement
2021 annual summary - it seems that I have done everything except studying hard
Here, the DDS tutorial you want | first experience of fastdds - source code compilation & Installation & Testing
Ternsort model integration summary
AI should take code agriculture? Deepmind offers a programming version of "Alpha dog" alphacode that surpasses nearly half of programmers!
2020 Summary - Magic year, magic me
Global function Encyclopedia
03_ Armv8 instruction set introduction load and store instructions
Application of slice
Login operation (for user name and password)
SSH principle and public key authentication
template<typename MAP, typename LIST, typename First, typename ... Keytypes > recursive call with indefinite parameters - beauty of Pan China
Video analysis
How to use the mongodb ID array to get multiple documents- How to get multiple document using array of MongoDb id?