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

Re: getting the date


  • Subject: Re: getting the date
  • From: Graff <email@hidden>
  • Date: Tue, 30 Dec 2003 12:36:25 -0500

This solution should work fine. It is independent of any localization settings that you may have for date and time formats. I believe it requires AppleScript 1.9 or later.
-------------
on ZeroPad(theNumber)
set theString to ""
if theNumber is less than 10 then set theString to "0"
set theString to theString & theNumber
return theString
end ZeroPad

set theDate to current date
set dayString to ZeroPad((day of theDate) as integer)
set monthString to ZeroPad((month of theDate) as integer)
set yearString to ZeroPad((year of theDate) mod 100)

set theDateString to yearString & monthString & dayString
-------------

- Ken

On Dec 30, 2003, at 10:37 AM, Simon Kidd wrote:

Iam trying to make a folder with the current date, Ive found that:

set days_date to current date

gives me the date and time in this format "date "Tuesday, 30 December, 2003 10.34.27am""

is there a way of getting the date like so: "031230"
_______________________________________________
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 the date
      • From: Walter Ian Kaye <email@hidden>
    • NUTD 4.5.1 scripting crashing it like mad
      • From: "John C. Welch" <email@hidden>
References: 
 >getting the date (From: Simon Kidd <email@hidden>)

  • Prev by Date: Re: getting the date
  • Next by Date: NUTD 4.5.1 scripting crashing it like mad
  • Previous by thread: Re: getting the date
  • Next by thread: NUTD 4.5.1 scripting crashing it like mad
  • Index(es):
    • Date
    • Thread