short or long (date and time)format display
2006-09-22 19:39
483 查看
declare @dt datetime
set @dt=getdate()
------short date format(yyyy-m-d)
select replace(convert(varchar(10),@dt,120),N'-0','-')
--------long date format(yyyy年mm月dd日)
select stuff(stuff(convert(char(8),@dt,112),5,0,N'年'),8,0,N)-----2006年09月22日
go-----
-------------complete date+time:yyyy-mm-dd hh:mi:ss:mmm
select convert(char(11),getdate(),120)+convert(char(12),getdate(),114)
set @dt=getdate()
------short date format(yyyy-m-d)
select replace(convert(varchar(10),@dt,120),N'-0','-')
--------long date format(yyyy年mm月dd日)
select stuff(stuff(convert(char(8),@dt,112),5,0,N'年'),8,0,N)-----2006年09月22日
go-----
-------------complete date+time:yyyy-mm-dd hh:mi:ss:mmm
select convert(char(11),getdate(),120)+convert(char(12),getdate(),114)
相关文章推荐
- C# ShortTime LongTime ShortDate LongDate 的区别
- 'Conversion failed when converting date and/or time from character string.DB-Lib error message 241,
- Custom Date and Time Format Strings
- How to format date for display or to use in a shell script
- 10 ways to format time and date using JavaScript
- [React Intl] Format Date and Time Using react-intl FormattedDate and FormattedTime
- Custom Date and Time Format Strings
- 从 varchar 数据类型到 datetime 数据类型的转换产生一个超出范围的值/Conversion failed when converting date and/or time from c
- Date and Time Format Patterns
- Java and unsigned int, unsigned short, unsigned byte, unsigned long, etc. (Or rather, the lack thereof)
- ASP Format Date and Time Script
- Java 8 Date Time API Example Tutorial – LocalDate, Instant, LocalDateTime, Parse and Format
- Formatting Time and Date: The Time and Date Format Suffixes
- http://xsk.tehon.org/den/index.php/category/tech/short-or-long-tcp-connection-and-keepalive.html
- [quote]HowTo Format Date For Display or Use In a Shell Script
- [原创]DateTime在使用 format Custom Date and Time Format Strings时遇到的问题和解决方法
- Java Date, Time and Format
- DATE_FORMAT(public_time,'%Y-%m-%d %H:%i:%S') + xml中 > <
- How to do run-time (or explicit) linking of C++ plug-in components and objects
- How draw a stem -and -leaf & box-plot display by R.or Python