Tuesday, September 30, 2014

#1 2005-10-13 04:00:26 pm

julifos
Administrator
From: MalasaƱa, Madrid
Registered: 2002-11-20
Posts: 2014

I want to get the month of a certain date as a number...

The following code can be used to retrieve the month of a date in numeric format:

Applescript:

set theDate to the (current date) -- or any other date
copy theDate to theFirstMonthDate
set the month of theFirstMonthDate to January
set monthNum to (1 + (theDate - theFirstMonthDate + 1314864) div 2629728)

This feature was introduced nativelly in AppleScript 1.9.2, so you can now simply ask for "January as number" and you will get the integer "1".

Offline

 

Board footer

Powered by FluxBB

[ Generated in 0.031 seconds, 10 queries executed ]

RSS (new topics) RSS (active topics)