<< Current Date >>
This Applescript gets the current date: current date.
Just type those 2 words into a blank Script Editor document and click the Run button. In the Result pane at the bottom of the window you’ll see a line like date "Monday 16 August 2010 20:47:32 ".
The result includes the word ‘date’ and the speechmarks.
If all you wanted was the first part, Monday 16 August 2010, then you need to work with it a bit. You need to get the date string.
To get the time portion, 20:47:32 you’d get the time string.
Note: the symbol ¬ shows where you must press the Return key to make a new line.
set myDate to date string of (current date) ¬
myDate
set myTime to time string of (current date) ¬
myTime
set myWords to myTime & " " & myDate ¬
myWords
The result of that sequence of commands is the line "20:47:32 Monday 16 August 2010".
<< Tomorrow's Date >>
The date itself is stored as a bunch of numbers. Because they’re numbers you can do maths operations like add and subtract. Once you get the string the date becomes a bunch of words.
So, to get tomorrow’s date (I don’t need to care about the time), I need to find the Current Date and add 60 seconds * 60 minutes * 24 hours, or as I write it: (24*60*60).
set Tomorrow to (current date) + (24 * 60 * 60) ¬
set myTomorrow to (date string of Tomorrow)
The result of that sequence of commands when I run it on Tuesday, 17 August 2010 is the line "Wednesday 18 August 2010".
<< Short Date >>
In the file where I keep a record of each item I use I want the date like this: 20100817. That format would allow me to sort easily.
To get that format I need to get, and then work with, the Short Date in Applescript.
The Short Date string alone gets something like this: "18/08/2010", but that’s not quite what I want.
To turn the date around I have to pick out each bit, using code like ((items 4 through 5 of ShortDate) as string). Items 4 through 5 net me the 08 portion.
Here’s the code from my script:
set myTomorrow to ((current date) + (24 * 60 * 60)) ¬
set ShortDate to short date string of myTomorrow ¬
set stampText to "20" & ((items 9 through 10 of ShortDate) as string) & ((items 4 through 5 of ShortDate) as string) & ((items 1 through 2 of ShortDate) as string)
Out of all that I get stampText, which is the string I need in my preferred format: 20100817.
Reference:
Today and Tomorrow in Applescript
http://knowit.co.nz/2010/08/today-and-tomorrow-in-applescript
Thanks, very nice article.
ReplyDeletehow would i write a script that can check a file's datestamp and if it is older than 30 days it will show a popup message?
This comment has been removed by the author.
ReplyDeleteAndres Cheah: Apple: Get Date And Time With Applescript >>>>> Download Now
ReplyDelete>>>>> Download Full
Andres Cheah: Apple: Get Date And Time With Applescript >>>>> Download LINK
>>>>> Download Now
Andres Cheah: Apple: Get Date And Time With Applescript >>>>> Download Full
>>>>> Download LINK
sakarya
ReplyDeleteelazığ
sinop
siirt
van
RXGV
Bolu Lojistik
ReplyDeleteMardin Lojistik
Kocaeli Lojistik
Diyarbakır Lojistik
İstanbul Lojistik
NOM8CB
23510
ReplyDeleteAksaray Şehirler Arası Nakliyat
Edirne Evden Eve Nakliyat
Antalya Evden Eve Nakliyat
Ünye Petek Temizleme
Muğla Parça Eşya Taşıma
Çanakkale Lojistik
Kırşehir Şehir İçi Nakliyat
Kütahya Şehir İçi Nakliyat
Ankara Fayans Ustası
8B489
ReplyDeleteMercatox Güvenilir mi
Manisa Şehirler Arası Nakliyat
Mardin Evden Eve Nakliyat
Iğdır Parça Eşya Taşıma
Telcoin Coin Hangi Borsada
Siirt Evden Eve Nakliyat
Kırıkkale Şehir İçi Nakliyat
Kastamonu Şehir İçi Nakliyat
Çanakkale Evden Eve Nakliyat
27546
ReplyDeleteantep telefonda kızlarla sohbet
manisa sohbet sitesi
denizli sesli sohbet siteler
tunceli sohbet siteleri
bedava sohbet odaları
edirne canlı sohbet siteleri
kırıkkale ücretsiz sohbet uygulaması
en iyi ücretsiz sohbet uygulamaları
bingöl sesli sohbet sitesi
49416
ReplyDeletetunceli sesli sohbet
kadınlarla görüntülü sohbet
görüntülü sohbet siteleri
maraş sesli sohbet uygulamaları
denizli mobil sohbet siteleri
osmaniye parasız sohbet
kadınlarla sohbet et
uşak rastgele sohbet odaları
goruntulu sohbet
A9CA5
ReplyDeleteBinance Nasıl Oynanır
Parasız Görüntülü Sohbet
Okex Borsası Güvenilir mi
Vector Coin Hangi Borsada
Onlyfans Takipçi Satın Al
Youtube Beğeni Hilesi
Binance Ne Zaman Kuruldu
Binance'de Kaldıraç Var mı
Loop Network Coin Hangi Borsada
C959C
ReplyDeleteDxy Coin Hangi Borsada
Paribu Borsası Güvenilir mi
Linkedin Beğeni Satın Al
Mexc Borsası Kimin
Binance Para Kazanma
Clysterum Coin Hangi Borsada
Binance Referans Kodu
Soundcloud Reposts Hilesi
Raca Coin Hangi Borsada
شركة تنظيف سجاد بالجبيل nme2KqfZ08
ReplyDeleteرقم المجاري بالاحساء x7MPplmsdK
ReplyDeleteتسليك مجاري 8PsMhQo26x
ReplyDelete