Skip to content
Advertisement

convert datetime (mm/dd/YYYY) to decimal(YYYYmmDD)

I am trying to get the following result in Sql:

example: 23/05/2014 to 20142305

but get this:

result:41780

anyone know how you can get the following format?? (if possible ??)

regards and thanks

Advertisement

Answer

In many databases (including SQL Server), you can just do:

Some databases don’t support these functions, so you might need extract(datepart from datetime) or a similar function.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement