Thursday, October 6, 2022

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

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:


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".



Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)