Lasse Edsvik wrote:
I just installed a win2k server with sql2k and when i run
datepart(wk,getdate()) it gives the american day of week, not european were
monday =1 how do i fix that? can i set something in control panel?
everywhere i look in regional settings I see it all set to swedish
The VBScript documentation for DatePart tells that Sunday is assumed as
the first day of the week unless you pass in the third argument to DatePart.
Here is an example:
<%@ Language="VBScript" %>
<%
Dim currentDate
currentDate = Now
Response.Write "<p>" & currentDate & "</p>"
Response.Write "<p>" & DatePart("w", currentDate) & "</p>"
Response.Write "<p>" & DatePart("w", currentDate, vbMonday) & "</p>"
Response.Write "<p>" & DatePart("w", currentDate, vbUseSystemDayOfWeek)
& "</p>"
%>
Here on my German Windows XP system the output is
12.03.2004 17:39:09
6
5
5
which means you either need to pass in vbMonday to explictly use that as
the first day of the week or you can pass in vbUseSystemDayOfWeek as
then the system settings are used (which I understand from your post
should be Monday as the first day of the week)
--
Martin Honnen
http://JavaScript.FAQTs.com/