Hello everyone!

I'm trying to get a date from SQL without the year. Every code I've seen has included the year. Here is what I have now.

SELECT * , convert(CHAR, \"date\", 10) AS ndate from dbo.MYDB where 35 > DATEDIFF(d,\"date\", GETDATE())";

I would like ndate to be show like mm-dd with now year.

Any suggestions?

Thank you!

Use a combination of convert and substring to pick off the first 5 characters, then concatenate with year.

substring(convert(char(8), getdate(), 10), 1, 5)

Use a combination of convert and substring to pick off the first 5 characters, then concatenate with year.

substring(convert(char(8), getdate(), 10), 1, 5)

Excellent, thank you!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.