NetTalk Central

Author Topic: Date field - any way to change the date calculation for a weekno?  (Read 2888 times)

Niels Larsen

  • Sr. Member
  • ****
  • Posts: 431
    • View Profile
    • Email
Hi

If I enter W17 in my date field i get the date 29. march 2012. In "my" world it should be 23. march 2012. Where I come from the first day in a week is monday and the first day in week no. 17 is the 23. march.
Any way to change that.
It would be super cool to have this feature working the danish way and also maybe the possibility to change the letter from "W" to "U" as in uge (not week).

I know it's a lot to ask fore, but if there is an easy solution, I'll be happy.

Regards Niels

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Date field - any way to change the date calculation for a weekno?
« Reply #1 on: April 27, 2012, 12:14:41 AM »
Hi Niels,

Actually, W17 should return 23 April - there was a bug in my code making it return 29 April.
I've fixed that in build 6.28.

Fortunately Denmark seems to follow the ISO 8601 standard for week numbers http://en.wikipedia.org/wiki/ISO_8601, which is what it was supposed to be handling there.

Incidentally, there is a method which you can override in the WebHandler procedure to "translate" the various shorthand of the dates to whatever you prefer. For example, in your case, if you wanted to add support for u17, then you would code the following in the WebHandler, in the .Interpret method;

if lower(p_string) = 'u'
  return 'w'
end

In this way you can handle any number of words, or abbreviations that you like. You just interpret them here into the "normal" NetTalk name or abbreviation.

Cheers
Bruce

Niels Larsen

  • Sr. Member
  • ****
  • Posts: 431
    • View Profile
    • Email
Re: Date field - any way to change the date calculation for a weekno?
« Reply #2 on: April 27, 2012, 01:09:33 AM »
Super. Thanks !!!!