• 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: UNIX DATE
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: UNIX DATE


  • Subject: Re: UNIX DATE
  • From: Graff <email@hidden>
  • Date: Sun, 25 Apr 2004 01:58:43 -0400

Here's a quick example of how to do both of these fairly simply:
--------------
set theDate to current date
set theTime to time of theDate
set theSecond to format(theTime mod minutes)
set theMinute to format((theTime mod hours) div minutes)
set theHour to format(theTime div hours)
set theDay to format(day of theDate)
set theMonth to format(month of theDate as integer)
set theYear to (year of theDate) as string
set dateString to theYear & "-" & theMonth & "-" & theDay & " " & theHour & ":" & theMinute & ":" & theSecond

set dateNumString to theYear & theMonth & theDay & theHour & theMinute & theSecond

display dialog dateString & return & dateNumString

on format(theNumber)
if ((theNumber >= 1) and (theNumber < 10)) then
return "0" & theNumber
else
return "" & theNumber
end if
end format
--------------

- Ken

On Apr 24, 2004, at 5:15 PM, John Mistler wrote:

Is there a simple way to convert an applescript date such as:

date Friday, December 24, 2004 3:00:00 PM

to

a UNIX format such as

2004-12-24 15:00:00

or

20041224150000 ?
_______________________________________________
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.


References: 
 >UNIX DATE (From: John Mistler <email@hidden>)

  • Prev by Date: Re:Identifying special characters
  • Next by Date: Re: FolderActions bug?
  • Previous by thread: Re: UNIX DATE
  • Next by thread: Re: UNIX DATE
  • Index(es):
    • Date
    • Thread