db2有两种办法可以显示当前的日期, 缺省的日期格式与创建数据库时的 territory code 有关系,例如我的环境中格式为 yyyy-mm-dd:

[sql] view plain copy
  1. $ db2 "values current date"  
  2.   
  3. 1           
  4. ----------  
  5. 2017-03-14  
  6.   
  7.   1 record(s) selected.  
  8.   
  9.     
  10. $ db2 "SELECT current date FROM sysibm.sysdummy1"  
  11.   
  12. 1           
  13. ----------  
  14. 2017-03-14  
  15.   
  16.   1 record(s) selected.  

修改DB2中日期显示的格式

参考上图,如果您想修改成 dd.mm.yyyy ,那么需要进入到sqllib/bnd目录,绑定db2ubind.lst的时候,指定datetime为EUR

[sql] view plain copy
  1. $ cd $HOME/sqllib/bnd  
  2.   
  3. $ db2 bind @db2ubind.lst datetime EUR blocking all grant public      
  4.                                              
  5. $ db2 "values current date"  
  6.   
  7. 1           
  8. ----------  
  9. 14.03.2017  
  10.   
  11.   1 record(s) selected.  

相关文章:

  • 2021-07-16
  • 2021-10-09
  • 2021-07-26
  • 2021-11-27
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-05-25
  • 2022-12-23
  • 2021-08-06
  • 2022-12-23
  • 2022-12-23
  • 2022-01-06
相关资源
相似解决方案