• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Days and hours
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Days and hours


  • Subject: Re: Days and hours
  • From: Emile Schwarz <email@hidden>
  • Date: Fri, 21 Oct 2005 09:15:51 +0200

Hi Yvan, Nigel,

email@hidden wrote:

Hello Emile

I was close to write that you are right … most of the time ;-)

This time, you are wrong !

As far as I know, the AppleScript language guide claims that:
hours and minutes, like days and weeks are NOT properties of a date BUT are constants.


An AS date_time count a number of seconds since 01/01/1904 (If I remember well)

the constant minutes is defined as 60 (seconds)
the constant hours is defined as (60 x minutes)
the constant days is defined as (24 x hours)
the constant weeks is defined as (7 x days)

-- use your clock own format below
-- except if its settings are French / OS Language: Français
set dd to "20/10/2005"
set myDate to date dd
--set myDate to date "20 octobre 2005  5:10:15"

(*
-- Change that date to March 2nd, 1954; 11:45:00
-- a. DD:MM:YYYY
set day of myDate to 2
set month of myDate to March
set year of myDate to 1954
set date1 to get myDate
*)
-- b. HH:MM:SS
set time of myDate to (11 * hours) + (45 * minutes) + 0

-- give me the newly computed date
return myDate


Yvan KOENIG

My fault, I had a different programming language in mind and remember AppleScript hours, minutes, seconds --> bad code. AppleScript 1, Emile 0.



Nice way to set the time :)


Date: Thu, 20 Oct 2005 14:03:00 +0100
From: "Nigel Garvey" <email@hidden>
Subject: Re: Days and hours
To: "AppleScript Users" <email@hidden>

Emile Schwarz wrote on Thu, 20 Oct 2005 10:51:16 +0200:


Ho do you make the following working ?


>   tell (current date) to set {day, year, its month, day, time, myDate} to
> {1, 1968, May, 5, 20 * hours + 47 * minutes, it}


The variable 'mydate' ends up with the value of the date created.

  tell (current date) to set {day, year, its month, day, time, myDate} to
{1, 1968, May, 5, 20 * hours + 47 * minutes, it}
  display dialog (myDate as string)


'Current date' returns a date record, which is then told to reset its various properties and finally to set a variable to itself. Kinky, but legal.

This time, the script works fine here (don't know why it didn't work the first time.


Thanks all,

Emile


_______________________________________________ Do not post admin requests to the list. They will be ignored. Applescript-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Prev by Date: Address Book label properties
  • Next by Date: Re: Address Book label properties
  • Previous by thread: Re: Days and hours
  • Next by thread: Re: Days and hours
  • Index(es):
    • Date
    • Thread