[quote=132676:@Tim Turner]On Windows it adds the abbreviated day of the week in front of the regular Month day, year.
I don’t want it to print the day of the week but I can’t figure out why it’s doing that or how to stop it.[/quote]
Function stripDay(s as string) As string
s = replaceall(s,"Sun, ","")
s = replaceall(s,"Mon, ","")
s = replaceall(s,"Tue, ","")
s = replaceall(s,"Wed, ","")
s = replaceall(s,"Thu, ","")
s = replaceall(s,"Fri, ","")
s = replaceall(s,"Sat, ","")
Valid only if the user settings are English. Needs to be completed for other languages. The alternative is to create a method that builds the abbreviated date from d.day, d.month, d.year.
Actually, I am looking at Windows default user preferences, and Xojo’s date.AbbreviatedDate is yet another concept. Windows short date does not have the day of the week at all. And long date has the full day name, not the three characters one. But indeed the format can be customized to anything, including the three characters day.
My personal preference would go into building the appropriate string from the date properties. It is easy.
AbbreviatedDate is described well in the LR. On Windows 7, the “AbbreviatedDate” result is showing text “Thu, Oct 02, 2014” for the “Region and Language - Format” setting (accessible from Windows “Control Panel”) for “Long date” = “dddd, MMMM dd, yyyy”.
your code there st(d.month) prints 1 for January instead of what I want… which is “January”.
I can’t believe I have to write a lookup to translate the number to the month spelled out simply because the long date includes the day of the week. I guess I could split on , and remove the day of the week from the Long date returned and reform it into the string I want.
[quote=239721:@Tim Turner]Dave, your code there st(d.month) prints 1 for January instead of what I want… which is “January”.
Never meant to infer that it did produce “January”, since it was a rebuttal to the code below, which doesn’t work at all.
[quote=132901:@Lee Badham]When I want a date in the format I wish, I use :
dim d as new date
dim datestring as string = d.month+" “+d.day+”, "+d.year[/quote]
Yes Dave I realize I posted a year later… just did a search on this and found my old thread on it because I was revisiting this code and it was not working the way I wanted. I know you well enough to know you are an excellent programmer. No slight intended! More of a “how do I do this” response that was not well written.
This would work on my computer but what about every Mac that doesn’t do that? I don’t want another common suport question “How do I get rid of the day of the week on the cover of this report”? I’d rather code it so that it just prints the date like: January 7, 2016
I did a split on the “,” in the return from d.Longdate and then reformatted it. But now I wonder if that won’t work. If someone changes their regional settings per Wayne, then it won’t return the Day? and then my code will display just the year most likely. Is there a way to code the date so that it is not affected by what the regional settings are???