Re: get seconds
Re: get seconds
- Subject: Re: get seconds
- From: kai <email@hidden>
- Date: Sun, 12 Oct 2003 12:58:32 +0100
on Sun, 12 Oct 2003 13:11:29 +0200, Patrick Mast wrote:
>
how do i get the seconds from 1970 on?
>
>
i wrote a script that is counting al the days an is then calculating
>
the seconds.
>
>
i saw a shell command <gettimeofday> but i do not succeed in getting
>
the seconds back.
>
it must be something like
>
>
return do shell script "gettimeofday()"
>
>
what parameters do i need for this command and how is it written
>
properly? i do not really understand the man.
Plain ol' vanilla AppleScript should give you what you need, Patrick. Try
something like this:
------------------------------------------
set startDate to date "1/1/1970"
set secsElapsed to (current date) - startDate
------------------------------------------
To calculate other time units you could use AS constants:
------------------------------------------
set minsElapsed to secsElapsed div minutes
set hoursElapsed to secsElapsed div hours
set daysElapsed to secsElapsed div days
set weeksElapsed to secsElapsed div weeks
------------------------------------------
{secsElapsed, minsElapsed, hoursElapsed, daysElapsed, weeksElapsed}
--> {1.065963415E+9, 17766056, 296100, 12337, 1762}
---
kai
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.