String and Datetime transform each other

MSSqlserver:

 1. Convert string to datetime

cast('2015-08-26' as datetime) or convert(datetime,'2015-08-26')

 

2. Convert string to datetime

  

Oracle:

1. Convert string to datetime

TO_DATE(yourdate,'YYYY-MM-D HH24:MI:SS');  Ex: select to_date('2010-01-01') from dual

T0_CHAR(yourdate,'YYYY-MM-D HH24:MI:SS');

  

2. Convert string to datetime

 

posted on 2015-09-04 22:16  小柑  阅读(128)  评论(0编辑  收藏  举报