e股脑电脑教程网
  • 首 页
  • 操作系统
  • 应用软件
  • 下载工具
  • 影音视频
  • 办公软件
  • 媒体制作
  • 网站建设
  • 平面设计
  • 数据库
  • 程序开发
  • 视频教程
编辑推荐: | 文章搜索:
您现在的位置: e股脑 >> 程序开发 >> PowerBuilder教程 >> 使用日期格式时的一些问题 >> 教程正文
 
教程搜索
 
 
相关教程
  • 在PowerBuilder中利用Dat
  • 什么是“pbcat表?
  • 修改PB6的PBL,使之在PB5中
  • 使用日期格式时的一些问题
  • 如何存取二进制大对象(BL
  • 关于PowerBuilder的补丁包
  • 如果在isql中建立表或者增
  • PB高级开发环境配置
  • 动态设置Win95和NT的缺省
  • PowerBuilder6.0运行环境
  • PowerBuilder、InfoMaker
  • PB API调用原型
  • 如何用VC创建可在PB中调用
  • PB应用技巧——数据窗口自
  • 为PB加入具有布局功能的容
  • PB7.0通用选字段查询窗口
 
 
赞 助 商
 
 
使用日期格式时的一些问题
  • 来源:e股脑
  • 点击次数:
  • 更新时间:2007-8-9

Date Formatting Troubleshooting Tips SUMMARY: There are sometimes problems using a special date formatting in date columns, especially when using an european date format. This techdoc explains the workarounds that can be used to achieve correct results. Document ID: 1002124 Last Revised: 01/12/2000 Topic: App Development Document Type: TechNote Product: PowerBuilder Version: 7.0 Platform: PC Operating System: Windows 95, Windows NT

Document:

There are sometimes problems using a special date formatting in datecolumns, especially when using an european date format. Thistechdoc explains the workarounds that can be used to achievecorrect results for the following CR's that are known in SybaseTechnical Support.

1.CR 210277 When setting a display format with a european dateformat eg. German dd.mm.yyyy in a HTML datawindow the wrongdatesequence in the HTML gets generated. This causes problemswhen trying to update the date, when the user tries to put in the date inthe local format.

2.CR 207244/147261 DDDW Display of date format changes to aformat of yyyy-mm-dd when getting focus.

1)Description of the problem:

Normally the date sequence which is generated by the Jaguarcomponent should be determined by the language settings in thecontrol panel. According to the HTML preview this is what getsgenerated:


// this is dependent on the control panel setting on the

server

// it indicates the order of days (this is mm/dd/yyyy)

var DW_PARSEDT_monseq = 0;

var DW_PARSEDT_dayseq = 1;

var DW_PARSEDT_yearseq = 2;

So when the date settings on the server are eg. Dd/mm/yyyy it shouldget reflected in the generated HTML, but due to the incorrect behaviorit does not pick up the changes in the language settings.

Workaround:

To overcome this problem the date sequence needs to be adjusted tothe language settings. In order to implement this for the previousexample (dd/mm/yyyy) the generated HTML needs to be modified

before being passed back to the client.

This can be done by modifying the HTMLGenerator component ie. byextending the code in the generate() method ofnv_remote_datawindow allows the correct HTML to be passed backto the client browser.

The method looks as follows:

string ls_result

if ib_trace then of_log_enter("Generate()")

ls_result = ids_datastore.Describe("DataWindow.Data.HTML")

//

// This is the date order without modification

//

//var DW_PARSEDT_monseq = 0;

//var DW_PARSEDT_dayseq = 1;

//var DW_PARSEDT_yearseq = 2;

//

// This should be the date order for German date sequence

dd.mm.yyyy

//


//var DW_PARSEDT_monseq = 1;

//var DW_PARSEDT_dayseq = 0;

//var DW_PARSEDT_yearseq = 2;

string DW_PARSEDT_monseq ="DW_PARSEDT_monseq = 0"

//Month-String to be found

string DW_PARSEDT_dayseq ="DW_PARSEDT_dayseq = 1"

//Day-string to be found

string DW_PARSEDT_monseq_new ="DW_PARSEDT_monseq =

1" //Replacement for default month

string DW_PARSEDT_dayseq_new ="DW_PARSEDT_dayseq = 0"

//Replacement for default day settings

long position

position = pos(ls_result, DW_PARSEDT_monseq ) //Gets the variable

position in the html code

ls_result = Replace ( ls_result, position, 21,

DW_PARSEDT_monseq_new )

position = pos(ls_result, DW_PARSEDT_dayseq ) //Gets the variable

position in the html code

ls_result = Replace ( ls_result, position, 21,

DW_PARSEDT_dayseq_new )

if ib_trace then of_log_exit("Generate(), length = " +

String(Len(ls_result)))

of_completeWork()

return ls_result

2)Description of the problem:

Assume you have a normal tabular datawindow containing a datecolumn. This date column should be of type dropdowndatawindow toallow users to select special predefined dates having the formating ofdd/mm/yyyy.

The base column (here column start_date) should also have thedd/mm/yyyy format. The nature of the problem is, that when the columnge

[1] [2] 下一页

  • 上一篇教程: 如何存取二进制大对象(BLOBs)
  • 下一篇教程: 修改PB6的PBL,使之在PB5中可用
  •  

    关于本站 | 广告联系 | 版权声明 | 使用帮助

    Copyright © 2004-2008 www.egunao.com All rights reserved.