Show Current Date-
Show Current Date Then Use-
Show Current Date Then Use-
SELECT GETDATE() AS CurrentDate
OutPut-
2016-06-08 12:11:00.083
More Format In Date Then Use-
Ex. 1:
SELECT CONVERT(varchar(20),GETDATE(),100) AS CurrentDate
OutPut-
Jun 8 2016 12:13PM
Ex.2:
SELECT CONVERT(varchar(20),GETDATE(),101) AS CurrentDate
OutPut
06/08/2016
Ex.3:
SELECT CONVERT(varchar(20),GETDATE(),102) AS CurrentDate
OutPut
2016.06.08
Ex.4:
SELECT CONVERT(varchar(20),GETDATE(),103) AS CurrentDate
OutPut
08/06/2016
Ex.5
- CONVERT(varchar(20),GETDATE(),104) = 08.06.2016.
- CONVERT(varchar(20),GETDATE(),105 )= 08-06-2016
- CONVERT(varchar(20),GETDATE(),106) = 08 Jun 2016
- CONVERT(varchar(20),GETDATE(),107) = Jun 08, 2016
- CONVERT(varchar(20),GETDATE(),108) = 12:24:08
- CONVERT(varchar(20),GETDATE(),109) = Jun 08, 2016
- CONVERT(varchar(20),GETDATE(),110) = 06-08-2016
- CONVERT(varchar(20),GETDATE(),111) = 2016/06/08
- CONVERT(varchar(20),GETDATE(),112) = 20160608
- CONVERT(varchar(20),GETDATE(),113) = 08 Jun 2016 12:26:08
ONLY FATCH TIME IN DATE THEN USE
EX.1
SELECT (LTRIM( RIGHT(CONVERT(varchar(20),GETDATE(),100),7))) as CURRENTTime
OutPut
12:28PM
0 comments :
Post a Comment