Page 1 of 1
Problem with dateItems (Day of the Week)
Posted: Tue Sep 29, 2015 11:00 pm
by pink
I have a program that converts a timestamp in seconds to dateItems, and then uses item #7 of date items to determine whether it is a weekday or a weekend. The number does not seem to be coming up correctly.
When I convert to dateItems, the date and time appear correctly for the time zone I am currently in, but the day of the week seems to be off. Today for example is Tuesday, but if I take the seconds right now (1443563834) and convert to dateItems I get: 2015,9,29,17,57,14,3
Date is correct, time is correct. According to the dictionary, the number for day of the week should be "2" but I am getting "3".
Am I missing something here?
From the dictionary:
Comments:
The dateItems format is a comma-separated list of numbers:
* the year
* the month number
* the day of the month
* the hour in 24-hour time
* the minute
* the second
* the numeric day of the week where Monday is day 1, Tuesday is day 2, and so forth
Re: Problem with dateItems (Day of the Week)
Posted: Tue Sep 29, 2015 11:27 pm
by dunbarx
Hi.
I have always relied on the fact that today, Tuesday, is #3 in item 7 of the dateItems. And so on...
The dictionary entry is the Bizarro version.
Craig Newman
Re: Problem with dateItems (Day of the Week)
Posted: Tue Sep 29, 2015 11:31 pm
by FourthWorld
Has this documentation error been submitted to the bug queue?
Re: Problem with dateItems (Day of the Week)
Posted: Tue Sep 29, 2015 11:33 pm
by dunbarx
I just actually looked in the dictionary. V, 6.7:
Comments:
The dateItems format is a comma-separated list of numbers:
* the year
* the month number
* the day of the month
* the hour in 24-hour time
* the minute
* the second
* the numeric day of the week where Sunday is day 1, Monday is day 2, and so forth
What version are you looking at?
Craig
Re: Problem with dateItems (Day of the Week)
Posted: Tue Sep 29, 2015 11:47 pm
by pink
I'm using 7.1, but I started writing this program back with 7.0.3, it's always said that...
however, when I look at the dictionary entry for "convert" it says the following:
Comments:
If the dateAndTime is a container, the converted date and time is placed in the container, replacing the previous contents. If the dateAndTime is a string, the converted date and time is placed in the it variable.
The dateItems format is a comma-separated list of numbers:
* the year
* the month number
* the day of the month
* the hour in 24-hour time
* the minute
* the second
* the numeric day of the week where Sunday is day 1, Monday is day 2, and so forth
Re: Problem with dateItems (Day of the Week)
Posted: Wed Sep 30, 2015 12:13 am
by bn
Hi,
I just looked it up and this documentation error was introduced in 6.7.3, in 6.7.2 the dictionary says day 1 of the week Sunday.
DateItems for Hypercard and LC always started the week on Sunday as it is custom in the USA.
The ISO Week has Monday as day 1. It is used in many parts of the world.
That is probably where the mix-up comes from.
Kind regards
Bernd
Re: Problem with dateItems (Day of the Week)
Posted: Wed Sep 30, 2015 12:26 am
by pink
this is really rather odd... I switched to a Windows computer, and the dictionary entry for dateItems is correct, but on all of my Macs, the entry is incorrect
anyhow, I'm submitting the bug report
Re: Problem with dateItems (Day of the Week)
Posted: Wed Sep 30, 2015 1:06 am
by pink
it's incorrect on the web version of the dictionary too:
https://livecode.com/resources/api/#liv ... /dateitems
Re: Problem with dateItems (Day of the Week)
Posted: Wed Sep 30, 2015 1:53 am
by FourthWorld
What's the bug report number?
Re: Problem with dateItems (Day of the Week)
Posted: Wed Sep 30, 2015 11:20 am
by pink