• 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: How to use date of current date
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to use date of current date


  • Subject: Re: How to use date of current date
  • From: Brian Christmas <email@hidden>
  • Date: Wed, 31 Oct 2012 20:59:01 +1100

 

PS: I need to get SQLDate (YYYY-MM-DD) and I feel that I will have to do it by myself…).


Emile, is this the sort of thing you want?

set cd to current date
display dialog my sqlConversion(cd)
set cd2 to cd - days * 6
display dialog my sqlConversion(cd2)
set cd3 to cd
set month of cd3 to 5
display dialog my sqlConversion(cd3)
set month of cd3 to February # being the 31st today, the extra 3 days will 'spill over' into March
display dialog my sqlConversion(cd3)
set cd4 to date "1 4 2012"
display dialog my sqlConversion(cd4)


on sqlConversion(cd)
set d to day of cd
if d < 10 then set d to "0" & d
set m to month of cd as number
if m < 10 then set m to "0" & m
set sqlDate to year of cd & "-" & m & "-" & d as text
return sqlDate
end sqlConversion

 _______________________________________________
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/archives/applescript-users

This email sent to email@hidden

References: 
 >How to use date of current date (From: "emile.a.schwarz" <email@hidden>)

  • Prev by Date: Re: How to use date of current date
  • Next by Date: Re: How to use date of current date
  • Previous by thread: Re: How to use date of current date
  • Next by thread: Re: How to use date of current date
  • Index(es):
    • Date
    • Thread