MySql %w date format parameter equivalent for MS-SQL SERVER

1021 views sql-server
2

In MySQL to get the day of week we use '%w' format parameter.what is ms sqlserver equivalent doing that? i used 'ddd' but it give me the day name eg Saturday not the number.any suggestions?

this is what i've tried:

 select FORMAT( SYSDATETIME(), 'ddd', 'fa-IR' )

between i am aware of DATEPART(weekday , GETDATE()) but is lacks culture parameter.

answered question

1 Answer

2

You want DATEPART:

DATEPART(WEEKDAY, YourDateColumn)

Note that the return value varies by language, as different languages treat different days as the first day of the week.

posted this

Have an answer?

JD

Please login first before posting an answer.