• 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: Getting time components of date
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting time components of date


  • Subject: Re: Getting time components of date
  • From: Deivy Petrescu <email@hidden>
  • Date: Mon, 22 Dec 2003 11:49:05 -0500

At 7:59 AM -0500 12/22/03, Chris Garaffa wrote:
Hi all,

While working to convert an AppleScript date to a MySQL DATETIME date (yyyy-mm-dd hh:mm:ss) I ran into a small problem. While AppleScript supports things like:
month of someDate
day of someDate
year of someDate
etc
It doesn't provide for
hour of someDate
minute of someDate
seconds of someDate

but instead gives us "time string". Using this and some TID manipulation, I was able to get the information I wanted [1] but I think it should be easier. I've filed a feature request with Apple and hope that anyone else who agrees will do the same.

Thanks!

Chris; without any string manipulation, just some simple math:

<script>
set ct to current date
set sd to date (short date string of ct)
set horas to (ct - sd) div 3600
set minutos to ((ct - sd) mod 3600) div 60
set segundos to (((ct - sd) mod 3600) mod 60)
{horas, minutos, segundos}
--->{11, 45, 46}
</script>

--
Regards
Saudagues

Deivy
http://www.dicas.com
_______________________________________________
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.

  • Follow-Ups:
    • Re: Getting time components of date
      • From: Christopher Stone <email@hidden>
References: 
 >Getting time components of date (From: Chris Garaffa <email@hidden>)

  • Prev by Date: strange new error
  • Next by Date: Re: Getting time components of date
  • Previous by thread: Re: Getting time components of date
  • Next by thread: Re: Getting time components of date
  • Index(es):
    • Date
    • Thread