User Tools

Site Tools


token:ICUDateTime

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
token:ICUDateTime [2017/09/07 00:11]
peternlewis
token:ICUDateTime [2021/10/19 22:39]
peternlewis
Line 3: Line 3:
 The //​%ICUDateTime%//,​ //​%ICUDateTimePlus%//,​ //​%ICUDateTimeMinus%//​ and //​%ICUDateTimeFor%//​ tokens return the a date formatted in a specific format. ​ More details are provided in the [[:​Dates_and_Times|Dates and Times]] article. The //​%ICUDateTime%//,​ //​%ICUDateTimePlus%//,​ //​%ICUDateTimeMinus%//​ and //​%ICUDateTimeFor%//​ tokens return the a date formatted in a specific format. ​ More details are provided in the [[:​Dates_and_Times|Dates and Times]] article.
  
-===== Fields & Format Used by These Tokens =====+===== Required Parameters for ICUDateTime ​Tokens =====
  
 +The parameters are specified between `%` signs after the main ICDDateTime token.
  
-//​%ICUDateTime%**format**%// - the current date and time. +* %**ICUDateTime**%<color #​22b14c>​[output date format]</color>​% 
-//​%ICUDateTimeFor%NOW()+20%**format**%// - the specified [[:​unixtime]] ​date+  * Returns ​the current date and time in the specified format
-//%ICUDateTimePlus%3+6%Hours%**format**%// the current time plus a specified number ​of the specified ​time units. +* %**ICUDateTimeFor**%<color blue><​Seconds in [[:​unixtime|Unix Time]]><​/color>​%<​color #​22b14c>​[output date format]</color>​% 
-//%ICUDateTimeMinus%3+6%Hours%**format**%// the current time minus a specified number ​of the specified ​time units.+  * Returns Date/​Time ​specified ​by the [[:unixtime|Unix Time]], in the user's local time zone
 +* %**ICUDateTimePlus**%<color blue><​amount of time></​color>​%<color #​22b14c>​[unit of time]</​color>​%<color #​22b14c>​[output date format]</​color>​% 
 +  * Returns Date/Time calculated by the Current Date/Time PLUS the <color blue><​amount ​of time></​color>​ 
 +* %**ICUDateTimeMinus**%<color blue><​amount of time></​color>​%<color #​22b14c>​[unit of time]</​color>​%<color #​22b14c>​[output date format]</​color>​% 
 +  * Returns Date/Time calculated by the Current Date/Time MINUS the <color blue><​amount ​of time></​color>​
  
  
-===== Time Units =====+where \\ 
 +  * angle brackets <color blue><​ ></​color>​ denote a numeric parameter, may use a Variable and/or formula 
 +  * square brackets <color #​22b14c>​[ ]</​color>​ denote a text-only parameter, cannot use a Variable 
 +    *The _text-only_ parameters must be plain text, and be a valid choice for that parameter. 
 +  * <color #​22b14c>​[output date format]</​color>​ must conform to the [ICU Date/Time codes](https://​www.keyboardmaestro.com/​action/​linkthru?​icudatetimereference). 
 +  * <color blue><​Seconds in [[:​unixtime|Unix Time]]></​color>​ is the total number of seconds since the start of 1970, GMT. 
 +  * <color blue><​amount of time></​color>​ is an integer in the units of what you specific in the <color #​22b14c>​[unit of time]</​color>​ parameter. 
 +  * <color #​22b14c>​[unit of time]</​color>​ must be a time unit from the below list. 
 + 
 + 
 +===== Unit of Time =====
  
 The available time units for //​%ICUDateTimePlus%//​ and //​%ICUDateTimeMinus%//​ are: The available time units for //​%ICUDateTimePlus%//​ and //​%ICUDateTimeMinus%//​ are:
Line 31: Line 46:
 * Saturdays * Saturdays
  
-For a weekday ​(v8+), if you Plus 0, it will return the next appropriate day, possibly returning ​the start day if that is the correct ​day; if you Plus 1, it will return the next appropriate day, strictly after the starting day.+==== Using Plus 0 or 1 With Day of Week (v8+) ==== 
 + 
 +*  If the //Time Unit// is a day of the week (//​Sundays//​ thru //​Saturdays//​) 
 +  * **If you use a Plus 0** (//​%ICUDateTimePlus%**0**%//​)\\ 
 +it will return the next appropriate day for that day of week, possibly returning ​today if it is the same day of week as entered; 
 +    * So if Today is //​Tuesday//,​ and you use //​%ICUDateTimePlus%0%Tuesdays%//,​ then it will return Today'​s date. 
 +    * Whereas, if you use //​%ICUDateTimePlus%0%Wednesdays%//,​ it will return tomorrow'​s date. 
 +  * **If you use Plus 1** (//​%ICUDateTimePlus%**1**%//​)\\ 
 +it will return the next appropriate day, strictly after Today 
 + 
 +=== Examples === 
  
 For example, if today is Tuesday, September 5, 2017, you would get these results: For example, if today is Tuesday, September 5, 2017, you would get these results:
Line 39: Line 65:
  
 Note how Plus 0 and Plus 1 are the same unless today is the same as the weekday. ​ Also note that Plus 0 and Minus 0 is not the same (except when today is the same as the weekday). Note how Plus 0 and Plus 1 are the same unless today is the same as the weekday. ​ Also note that Plus 0 and Minus 0 is not the same (except when today is the same as the weekday).
 +
 ===== Format Specification ===== ===== Format Specification =====
  
Line 53: Line 80:
 ===== Using Variables with These Date/Time Tokens ===== ===== Using Variables with These Date/Time Tokens =====
  
-To use a Variable instead of a number in a token, like the ICUDateTimePlus token, ​just enter the Variable name without any additional ​%, as in:+You can use a number, Variable, and formula using Variables, ​in the _numeric_ parameters, like the amount of time in the  ​ICUDateTimePlus token, ​which has this format: \\ 
 + 
 +%**ICUDateTimePlus**%<​color blue><​amount of time></​color>​%<​color #​22b14c>​[unit of time]</​color>​%<​color #​22b14c>​[output date format]</​color>​% 
 + 
 +where \\ 
 +  * angle brackets <color blue><​ ></​color>​ denote a numeric parametermay use a Variable and/or formula 
 +  * square brackets <color #​22b14c>​[ ]</​color>​ denote a text-only parameter, cannot use a Variable 
 + 
 +The _text-only_ parameters must be plain text, and be a valid choice for that parameter. 
 + 
 +**Examples**
  
 ``` ```
-%ICUDateTimePlus%3%Days%yyyyMMdd+%ICUDateTimePlus%3%Days%MM/dd/yyyy
-%ICUDateTimePlus%YourVariableName%Days%yyyyMMdd%+%ICUDateTimePlus%myAmountOfTime%Days%yyyyMMdd
 +%ICUDateTimePlus%myBaseNumber + 3%Months%yyyy-MM-dd%
 ``` ```
  
-For an example, see [Generate File Named Based on Day of Week [Example]](https://​forum.keyboardmaestro.com/​t/​dates-generate-file-named-based-on-day-of-week-example/​4562)+Also See
  
-===== See Also =====+* [[https://​forum.keyboardmaestro.com/​t/​icu-time-multiple-variables/​18181/​2?​u=jmichaeltx|Discussion of Using Variables With ICUDateTime]] 
 +* [Generate File Named Based on Day of Week [Example]](https://​forum.keyboardmaestro.com/​t/​dates-generate-file-named-based-on-day-of-week-example/​4562)
  
-----+===== Localization ===== 
 + 
 +Prior to Mojave, and after Keyboard Maestro 9.0, dates should be in your chosen language. ​ Unfortunately Apple changed Mojave and later to make the system return dates only in the Keyboard Maestro localized language (ie, English), regardless of your chosen locale. ​ Keyboard Maestro 9.0 works around this by claiming to be in all locales, even though it is really only localized for English itself. 
 + 
 +===== See Also =====
  
-=== Actions ===+==== Actions ​====
  
 * [[action:​Set Variable to Text|Set Variable to Text]] * [[action:​Set Variable to Text|Set Variable to Text]]
 * [[:​Actions|See all Actions]] * [[:​Actions|See all Actions]]
  
-=== Functions ===+==== Functions ​====
  
 * [[function:​DAY|DAY()]] * [[function:​DAY|DAY()]]
Line 84: Line 127:
 * [[:​Functions|See all Functions]] * [[:​Functions|See all Functions]]
  
-=== Tokens ===+==== Tokens ​====
  
 * [[token:​ICUDateTimeFor|%ICUDateTimeFor%]] * [[token:​ICUDateTimeFor|%ICUDateTimeFor%]]
Line 96: Line 139:
 * [[:​Tokens|See all Tokens]] * [[:​Tokens|See all Tokens]]
  
-=== Topics ===+==== Topics ​====
  
 * [[:Dates and Times|Dates and Times]] * [[:Dates and Times|Dates and Times]]
Line 102: Line 145:
 * [[:​unixtime]] in GMT * [[:​unixtime]] in GMT
  
----- +===== Forum =====
- +
-==== Forum ====+
  
 - [[https://​forum.keyboardmaestro.com/​t/​adding-minutes-to-current-time/​3002/​2|Adding minutes to current time]] - [[https://​forum.keyboardmaestro.com/​t/​adding-minutes-to-current-time/​3002/​2|Adding minutes to current time]]
token/ICUDateTime.txt · Last modified: 2023/01/03 00:19 by ccstone