Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

use three parameters to create a date

how can i pass 3 parameters to form a date in sql for example @year @month @day

Basically my program sends the parts of the date seperatly and i want them to be joined in the stored procedure.

like image 447
MyHeadHurts Avatar asked Jan 26 '26 09:01

MyHeadHurts


1 Answers

Here is SO answer to a similar question.

CAST(CAST(y AS varchar) + '-' + CAST(m AS varchar) + '-' + CAST(d AS varchar) AS DATETIME)

(I assume you know how to pass 3 parameters to stored procedure)

like image 117
Dani Avatar answered Jan 28 '26 01:01

Dani



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!