AutoHotkey Community

It is currently May 27th, 2012, 11:20 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 32 posts ]  Go to page 1, 2, 3  Next
Author Message
PostPosted: October 5th, 2004, 4:17 pm 
Is there a chance to get a week eqivalent to this AHK variable ?

A_YDay - Current day of the year (1-366)

something like

A_YWeek - Current week of the year (1-52)

I've a request to reconfigure a process to create a folder on a weekly basis which should be named/labled this way ... :roll:

Thx.

8)


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: October 5th, 2004, 6:09 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
I think this will do it:

WeekOfYear = %A_YDay%
WeekOfYear /= 7
WeekOfYear++ ; Convert from 0-base to 1-base


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 6th, 2004, 12:57 pm 
Thx Chris :D


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: October 21st, 2004, 8:45 am 
Offline

Joined: July 30th, 2004, 11:30 pm
Posts: 74
Location: Deutschland (sorry for my english)
> A_YWeek - Current week of the year (1-52)

I want to second that.

Sure, Chris, your script could work too.
But iam pretty sure i don´t remeber this if i need it someday :lol:

So a build-in variable would be nice, at least for us non-hard core AHK users.

On the otherhand,
at least include your hint in the help near "build-in variables" would help ?

_________________
Image Stefan

This post was created with the kindly help of http://dict.leo.org/ and remember: “Allways look on the bright side of Life”


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 21st, 2004, 10:32 am 
Quote:
at least include your hint in the help near "build-in variables" would help
or a link to a "workaround" section of "Mallett-Certificated-Code-Snippets". :wink:

8)


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: October 21st, 2004, 11:33 am 
Offline

Joined: September 24th, 2004, 3:00 pm
Posts: 814
Location: Germany
Hi,

in germany it's not so easy.

If the Dec the 31st is a monday and week 52 then then Jan the 1st is also week 52 and not week 1. In the other way if Jan the 1st is a friday and week 1 then Dec the 31st is also week 1. The year with more days of the week gets the week. If the last week has 4 days or more in the current year it will be week 52 (or 53) but if the first week of the next year has 4 days or more, then the last week of the current year will be week 1

Well I hope you understand my bad english.

Tekl


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 21st, 2004, 12:20 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
Stefan wrote:
On the otherhand, at least include your hint in the help near "build-in variables" would help ?
Great idea, I will do that.

BoBo wrote:
or a link to a "workaround" section of "Mallett-Certificated-Code-Snippets".
Heheh, cute. In this case (since it's only 3 lines) I put it in there directly.

Tekl wrote:
in germany it's not so easy.

If the Dec the 31st is a monday and week 52 then then Jan the 1st is also week 52 and not week 1. In the other way if Jan the 1st is a friday and week 1 then Dec the 31st is also week 1. The year with more days of the week gets the week.
Good point. I wonder how common this is. Maybe someone can give background on the week-of-year concept and what it's typically used for.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 21st, 2004, 2:13 pm 
Offline

Joined: September 24th, 2004, 3:00 pm
Posts: 814
Location: Germany
Look at this:

http://www.cl.cam.ac.uk/~mgk25/iso-time.html

Tekl


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 21st, 2004, 3:13 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
Great link, thanks. Does anyone else feel that A_YWeek should be added? And if it is added, should it use the European method or the simple method (I imagine European would be more useful on average).


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 21st, 2004, 3:44 pm 
Offline

Joined: September 24th, 2004, 3:00 pm
Posts: 814
Location: Germany
Hi,

I think it could be usefull. Maybe you could use two variables:

A_YWeek
A_YWeekSimple

Tekl


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 21st, 2004, 7:10 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
I'm having a hard time imagining a use for A_YWeekSimple (if anyone knows of one, please share it). Another reason not to add A_YWeekSimple is that it's much easier to calculate manually that the European week-of-year.

My reluctance to add variables is mostly due to cluttering the help file with things that 99.9% of users would never use.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 21st, 2004, 7:25 pm 
Offline

Joined: September 7th, 2004, 9:20 pm
Posts: 275
Location: France
Here it is an explanation of the ISO number of the first week of the year in a web page about dates in Excel (http://www.cpearson.com/excel/weeknum.htm)
Quote:
ISO Week Numbers

The International Organization for Standardisation, based in Switzerland, issued Standard 8601 -- Representation Of Dates And Times, in 1988. This provides some standardization for "week numbers". Of course, compliance with these standards is entirely voluntary, so your business may or may not use the ISO definitions.

Under the ISO standard, a week always begins on a Monday, and ends on a Sunday. The first week of a year is that week which contains the first Thursday of the year, or, equivalently, contains Jan-4.

While this provides some standardization, it can lead to unexpected results -- namely that the first few days of a year may not be in week 1 at all. Instead, they will be in week 52 of the preceding year! For example, the year 2000 began on Saturday. Under the ISO standard, weeks always begin on a Monday. In 2000, the first Thursday was Jan-6, so week 1 begins the preceding Monday, or Jan-3. Therefore, the first two days of 2000, Jan-1 and Jan-2, fall into week 52 of 1999.

An ISO week number may be between 1 and 53. Under the ISO standard, week 1 will always have at least 4 days. If 1-Jan falls on a Friday, Saturday, or Sunday, the first few days of the year are defined as being in the last (52nd or 53rd) week of the previous year.

Unlike absolute week numbers, not every year will have a week 53. For example, the year 2000 does not have a week 53. Week 52 begins on Monday, 25-Dec, and ends on Sunday, 31-Dec. But the year 2004 does have a week 53, from Monday, 27-Dec , through Friday, 31-Dec.

I hope it can help...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 22nd, 2004, 4:02 pm 
Offline

Joined: July 30th, 2004, 11:30 pm
Posts: 74
Location: Deutschland (sorry for my english)
Hi Chris,

thanks for thinking about it.


> Maybe someone can give background on the week-of-year concept
> and what it's typically used for.

As far that i know at least companies count in weeks to 'plan dates'.
(if you smt buy a new kittchen, the delivery date is count in weeks, not in accurate day)

I on my own think about to use A_Week for backup issues.
(creating folders named "KW%A_Week%" , like D:\Backups\AHKScripts\2004\KW43 :lol:)
'KW' stands for german 'Kalender Woche', that means 'Calendar Week'

_________________
Image Stefan

This post was created with the kindly help of http://dict.leo.org/ and remember: “Allways look on the bright side of Life”


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 22nd, 2004, 4:24 pm 
Offline

Joined: July 30th, 2004, 11:30 pm
Posts: 74
Location: Deutschland (sorry for my english)
I just found this in registry.
Maybe it is for interest for 'our' A_Week issue ?


HKEY_CURRENT_USER\Control Panel\International\ iFirstDayOfWeek   == 0
HKEY_CURRENT_USER\Control Panel\International\ iFirstWeekOfYear   == 2


just wanna let you know.
(i mean, if you know current setting of current user, you could better calculate the week of year ?????)

_________________
Image Stefan

This post was created with the kindly help of http://dict.leo.org/ and remember: “Allways look on the bright side of Life”


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 22nd, 2004, 5:06 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
That's very interesting, thanks. It raises the issue of whether week-of-the-year should obey the user's region or should be the same for all regions.

By the way, what does A_WDay contain for today in your locale? I think it considers Sunday to be Day 1 in all locales. If this is true, it's probably better to have A_YWeek be a single method (probably the ISO method) rather than a method based on the user's locale. Otherwise, the same script would report a different week-of-the-year if the user switches to a different region, or if it is run on different computers.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 32 posts ]  Go to page 1, 2, 3  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 3 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group