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

Re: Date trouble


  • Subject: Re: Date trouble
  • From: Yvan KOENIG <email@hidden>
  • Date: Sat, 21 Oct 2006 08:24:41 +0200

Hello

Here are plain vanilla codes.

Version 1 for Mac OS X 10.4 and higher:
set cd to my normalize(current date)
log cd

on normalize(d)
 return "" & year of d & ":" & my pad((month of d) as number) & ¬
 ":" & my pad(day of d) & " " & my pad((time of d) div 3600) & ¬
 ":" & my pad(minutes of d) & ":" & my pad(seconds of d)
end normalize

on pad(n)
 return text -2 thru -1 of ("00" & n)
end pad


Version 2 for older OSs

set cd to my normalize(current date)
log cd

on normalize(d)
 set tt to (time of d)
 set hh to (tt div 3600)
 set mi to (tt div 60) - (hh * 60)
 set ss to (tt mod 60)
 return "" & year of d & ":" & my pad((month of d) as number) & ¬
 ":" & my pad(day of d) & " " & my pad(hh) & ¬
 ":" & my pad(mi) & ":" & my pad(ss)
end normalize

on pad(n)
	return text -2 thru -1 of ("00" & n)
end pad


I used them for years with no problem.

Yvan KOENIG _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/mailman//archives/applescript-users

This email sent to email@hidden
References: 
 >Date trouble (From: "W. Thomas Leroux" <email@hidden>)
 >Re: Date trouble (From: Barry Wainwright <email@hidden>)
 >Re: Date trouble (From: "Mark J. Reed" <email@hidden>)
 >Re: Date trouble (From: "Mark J. Reed" <email@hidden>)
 >Re: Date trouble (From: "Mark J. Reed" <email@hidden>)
 >Re: Date trouble (From: "Mark J. Reed" <email@hidden>)

  • Prev by Date: Re: FileMaker (Pro Advanced 8) bug?
  • Next by Date: Re: FileMaker (Pro Advanced 8) bug?
  • Previous by thread: Re: Date trouble
  • Next by thread: Re: Date trouble
  • Index(es):
    • Date
    • Thread