User Tools

Site Tools


Dates_and_Times

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 Both sides next revision
Dates_and_Times [2017/06/09 19:32]
JMichaelTX
Dates_and_Times [2017/09/07 00:11]
peternlewis
Line 1: Line 1:
 +{{:​date_and_time-icon.gif|}}
 +
 Dates and Times Dates and Times
 =============== ===============
-(Reference Page)\\ ​ + 
-{{:​date_and_time-icon.gif|}} ​ **Keyboard Maestro offers a very full featured set of date and time [[Tokens|tokens]],​ formats, and calculations.**\\  ​+Keyboard Maestro offers a very full featured set of date and time [[Tokens|tokens]],​ formats, and calculations.
  
 [[token:​ICUDateTime|Date/​Time tokens]] are like text expansion codes that return date/time values as text in the specified format. [[token:​ICUDateTime|Date/​Time tokens]] are like text expansion codes that return date/time values as text in the specified format.
Line 12: Line 14:
 The most commonly used token is for returning the current date/time in the format you like: The most commonly used token is for returning the current date/time in the format you like:
  
-''​%ICUDateTime%**format**%''​ where **format** is from the [ICU Date/Time codes](http://​userguide.icu-project.org/​formatparse/​datetime#​TOC-Date-Time-Format-Syntax).\\  ​+''​%ICUDateTime%**format**%''​ where **format** is from the [ICU Date/Time codes](http://​userguide.icu-project.org/​formatparse/​datetime#​TOC-Date-Time-Format-Syntax).
  
 For example, using the [[action:​Set_Variable_to_Text|Set Variable to Text]] Action:​\\ ​ For example, using the [[action:​Set_Variable_to_Text|Set Variable to Text]] Action:​\\ ​
Line 70: Line 72:
 |**//​%ICUDateTimeFor% TIME(<​Year>,​ <​Month>,​ <Day> [, <​Hour>,​ <​Min>,​ Sec>​])%<​format>​%//​**\\ ​ Sets absolute date/time (GMT)|Set absolute date in **GMT**\\ ​ %ICUDateTimeFor% TIME(2015, 12, 25) %EEE, MMM d, yyyy%\\ ​ => Thu, Dec 24, 2015\\ ​ \\  Set absolute date in **LOCAL** time\\ ​ %ICUDateTimeFor% TIME(2015, 12, 25) **- GMTOFFSET()** %EEE, MMM d, yyyy%\\ ​ => Fri, Dec 25, 2015| |**//​%ICUDateTimeFor% TIME(<​Year>,​ <​Month>,​ <Day> [, <​Hour>,​ <​Min>,​ Sec>​])%<​format>​%//​**\\ ​ Sets absolute date/time (GMT)|Set absolute date in **GMT**\\ ​ %ICUDateTimeFor% TIME(2015, 12, 25) %EEE, MMM d, yyyy%\\ ​ => Thu, Dec 24, 2015\\ ​ \\  Set absolute date in **LOCAL** time\\ ​ %ICUDateTimeFor% TIME(2015, 12, 25) **- GMTOFFSET()** %EEE, MMM d, yyyy%\\ ​ => Fri, Dec 25, 2015|
 |**//​%ICUDateTimePlus%<​Formula for Quantity>​%<​TimeUnit>​%<​format>​%//​**\\ ​ Using functions to calculate date offset.|**Get Date for Selected Prior Day Number**\\ ​ `%ICUDateTimePlus%-(DOW() + 7 - DayNum)%Days%EEE,​ MMM d, yyyy%`\\ If Current Date is Dec 25, 2016, and _DayNum_ is 1:\\  => Sun, Dec 18, 2016\\ where "​DayNum"​ is the number of the weekday (can be a Variable)| |**//​%ICUDateTimePlus%<​Formula for Quantity>​%<​TimeUnit>​%<​format>​%//​**\\ ​ Using functions to calculate date offset.|**Get Date for Selected Prior Day Number**\\ ​ `%ICUDateTimePlus%-(DOW() + 7 - DayNum)%Days%EEE,​ MMM d, yyyy%`\\ If Current Date is Dec 25, 2016, and _DayNum_ is 1:\\  => Sun, Dec 18, 2016\\ where "​DayNum"​ is the number of the weekday (can be a Variable)|
- 
  
 *where* *where*
  
-*<​TimeUnit>​ is one of the following: ​*Seconds, Minutes, Hours, Days, Weeks, Months, Years+* <​TimeUnit>​ is one of the following: Seconds, Minutes, Hours, Days, Weeks, Months, Years, or a weekday, Sundays, Mondays, Tuesdays, Wednesdays, Thursdays, Fridays, Saturdays.
 * <​Quantity>​ is the number of <​TimeUnit>​s * <​Quantity>​ is the number of <​TimeUnit>​s
 * <​format>​ is the format of text returned, using the [ICU Date/Time codes](http://​userguide.icu-project.org/​formatparse/​datetime#​TOC-Date-Time-Format-Syntax) * <​format>​ is the format of text returned, using the [ICU Date/Time codes](http://​userguide.icu-project.org/​formatparse/​datetime#​TOC-Date-Time-Format-Syntax)
Line 85: Line 86:
 Since [[function:​TIME|TIME()]] and [[function:​NOW|NOW()]] returns the specified date/time in GMT :!: , you can adjust for your local time zone by subtracting the [[function:​GMTOFFSET|GMTOFFSET()]] function Since [[function:​TIME|TIME()]] and [[function:​NOW|NOW()]] returns the specified date/time in GMT :!: , you can adjust for your local time zone by subtracting the [[function:​GMTOFFSET|GMTOFFSET()]] function
  
-:!:  FIXME -- this has been [[https://​forum.keyboardmaestro.com/​t/​issue-with-date-time-functions/​5856 | disputed]]. ​ `NOW()` and `TIME()` may be based on local time. +[[token:​ICUDateTimeFor|%ICUDateTimeFor%]] [[function:​TIME|TIME(2015,​ 12, 25)]] - [[function:​GMTOFFSET|GMTOFFSET()]] %EEE, MMM d, yyyy% => Fri, Dec 25, 2015
- +
-[[token:​ICUDateTimeFor|%ICUDateTimeFor%]] [[function:​TIME|TIME(2015,​ 12, 25)]] - [[function:​GMTOFFSET|GMTOFFSET()]] %EEE, MMM d, yyyy%\\   +
-=> Fri, Dec 25, 2015+
  
 ===== Date/Time Functions and Calculations ===== ===== Date/Time Functions and Calculations =====
Line 119: Line 117:
 ==== Mixing Functions and Tokens ==== ==== Mixing Functions and Tokens ====
  
-You might expect [[token:​ICUDateTimeFor|%ICUDateTimeFor%]] [[function:​TIME|TIME(2017,​ 1, 1)]] `%EEE, MMM d, yyyy%` to yield `Sun, Jan 1, 2017`.\\  +You might expect [[token:​ICUDateTimeFor|%ICUDateTimeFor%]] [[function:​TIME|TIME(2017,​ 1, 1)]] `%EEE, MMM d, yyyy%` to yield `Sun, Jan 1, 2017`. However, it may yield `Sat, Dec 31, 2016`, depending on your local time zone.
-However, it may yield `Sat, Dec 31, 2016`, depending on your local time zone. +
  
 Here is why: Here is why:
Line 137: Line 133:
  
 ===== See Also ===== ===== See Also =====
- 
----- 
  
 === Actions === === Actions ===
  
-* [[action:​Filter ​Clipboard|Filter ​Clipboard]] (Process Text Tokens) +* [[action:​Filter|Filter]] (Process Text Tokens)
-* [[action:​Filter Variable|Filter Variable]] (Process Text Tokens)+
 * [[:​Actions|See all Actions]] * [[:​Actions|See all Actions]]
- 
----- 
  
 ==== Forum ==== ==== Forum ====
Line 154: Line 145:
 - [[https://​forum.keyboardmaestro.com/​t/​previous-date-variables-best-way/​3311/​4|Previous Date Variables]] - [[https://​forum.keyboardmaestro.com/​t/​previous-date-variables-best-way/​3311/​4|Previous Date Variables]]
 - [[https://​forum.keyboardmaestro.com/​t/​icudatetime-format-from-locale/​3458/​5|%ICUDateTime% format from locale]] - [[https://​forum.keyboardmaestro.com/​t/​icudatetime-format-from-locale/​3458/​5|%ICUDateTime% format from locale]]
 +- [[https://​forum.keyboardmaestro.com/​t/​issue-with-date-time-functions/​5856|Issue with Date/Time Functions]]
 - [[https://​forum.keyboardmaestro.com/​tags/​date_time|Keyboard Maestro Forum topics about Dates and Times]] - [[https://​forum.keyboardmaestro.com/​tags/​date_time|Keyboard Maestro Forum topics about Dates and Times]]
-==== Related Pages ==== 
- 
-TBD\\  ​ 
- 
- 
----- 
-If you find any issues, or have any suggestions,​ concerning this page, please report them to [Draft Rewrite of Wiki Dates and Times Article](https://​forum.keyboardmaestro.com/​t/​draft-rewrite-of-wiki-dates-and-times-article/​2485/​1) 
Dates_and_Times.txt · Last modified: 2023/06/20 02:44 by peternlewis