• 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 get Zero (0) before Month ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to get Zero (0) before Month ?


  • Subject: Re: How to get Zero (0) before Month ?
  • From: John W Baxter <email@hidden>
  • Date: Sun, 16 Feb 2003 11:21:19 -0800
  • Envelope-to: email@hidden

At 13:04 -0600 2/16/2003, Michael Grant wrote:
>On 2/16/03 9:35 AM, "Krister Nyman" <email@hidden> wrote:
>
>> I always want to have month in two numbers, 01,02,03,04,05.....10,11,12
>> like it is with days.
>
>on twoDigits(aString)
> if (length of aString) < 2 then
> set aString to "0" & aString
> end if
> return aString
>end twoDigits

on twoDigits(aString)
set aString to "0" & aString
return text from -2 thru -1 of aString
end twoDigits

Tested with
display dialog twoDigits(1)
display dialog twoDigits(11)
display dialog twoDigits(111)

(Note...for this purpose, the result from the third test is probably
right...for other purposes, you have to decide whether long input should be
truncated from the left, or not.)

--John
--
John Baxter email@hidden Port Ludlow, WA, USA
_______________________________________________
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: 
 >Re: How to get Zero (0) before Month ? (From: Michael Grant <email@hidden>)

  • Prev by Date: Re: How to get Zero (0) before Month ?
  • Next by Date: [Q] Communicating with websites?
  • Previous by thread: Re: How to get Zero (0) before Month ?
  • Next by thread: Re: How to get Zero (0) before Month ?
  • Index(es):
    • Date
    • Thread