¿Cómo obtener solo la parte de fecha de getdate ()? [duplicar]
Frecuentes
Visto 202,515 veces
61
I have a SQL table that has a CreationDate field.
He getdate()
in the computed column specification formula.
I would like to know how to get just the date portion, that is, '2012-08-24' instead of '2012-08-24 10:45:17.740'.
5 Respuestas
86
If you are using SQL Server 2008 or later
select convert(date, getdate())
De lo contrario
select convert(varchar(10), getdate(),120)
Respondido 24 ago 12, 09:08
7
prueba esto:
select convert (date ,getdate())
or
select CAST (getdate() as DATE)
or
select convert(varchar(10), getdate(),121)
Respondido 24 ago 12, 09:08
3
Prueba esto:
SELECT CONVERT(date, GETDATE())
Respondido 24 ago 12, 09:08
3
SELECT CONVERT(date, GETDATE())
Respondido 24 ago 12, 09:08
3
SELECT CAST(FLOOR(CAST(GETDATE() AS float)) as datetime)
or
SELECT CONVERT(datetime,FLOOR(CONVERT(float,GETDATE())))
contestado el 22 de mayo de 14 a las 01:05
No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas sql-server tsql or haz tu propia pregunta.
If this is SQL Server, which it looks like, you should use the SQL-server tag in addition to your current tags - podiluska