Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

function "Weekday(Date)" returns different number in UK from US 2

Status
Not open for further replies.

Poduska

Technical User
Dec 3, 2002
108
US
I have a VB module which creates an Excel file and then gives it a name using the following code
Code:
  ReportName = "Range Availability "
   FileName = ReportName & _
              Format((Date), "dd-mm-yy") & _
              " run " & WeekdayName(weekday(Date)) & _
              " at " & Format(Now(), "hh") & " " & Format(Now(), "nnAM/PM")

When someone runs the code in the UK it returns this file name of

Range Availability 30-03-07 run Saturday at 10 09AM.xls

When I run the code from the US it returns this file name of

Range Availability 30-03-07 run Friday at 10 09AM.xls


The database actually resides in the UK but I do not think this is a problem.
I KNOW that 30-03-07 is the same day of the week in both places at this time of day, soooo.... any ideas???
Is this caused by Windows? Does Windows in the UK count Monday as the first day of the week instad of Sunday?

Thanks for any Tek-Tips insight
 
You need to set the first day of week. It is an option with both Weekday and WeekdayName.
 
Why not simply this ?
FileName = ReportName & Format(Now, "dd-mm-yy ru\n dddd at hh nnAM/PM")

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Really now,

Why would I want to replace 5 lines of code full of "&" symbols with ONE simple line of code that actually works ???? [thumbsup]

I think I will use the one line!

Thanks for the simple solution.
Stars for both as both posts will work!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top