-
Notifications
You must be signed in to change notification settings - Fork 3
Home
aa1024 edited this page Jun 19, 2018
·
7 revisions
Welcome to the datetimeQ wiki!
Datetime Formatter
Format the date as per the given date format
| param f: | Date formatter e.g. "dd-mm-yyyy" |
|---|---|
| param dt: | Date to be formatted |
| returns: | Formatted date |
q)format[fmt:"d/m/yyyy"; dt:2018.06.08]q)format["d mmmm, dddd ,yyyy"; 2018.06.18]q)format[f:"yy-mm-dd hh:uu:ss.000"; 2018.06.08T01:02:03.456]q)do[1000;format[fmt:"yy-mm-dd hh:uu:ss.000 AM/PM"; dt:2018.06.08T21:02:03.456]]Returns Months as 1-12
| param x: | Date to be formatted |
|---|---|
| returns: | PMnth |
q)m[2018.06.08]Returns Months as 1-12
| param x: | Date to be formatted |
|---|---|
| returns: | month |
q)mm[2018.06.08]Months as Jan-Dec
| param x: | Date to be formatted |
|---|---|
| returns: | month |
q)mmm[2018.06.08]Months as January-December
| param x: | Date to be formatted |
|---|---|
| returns: | month |
q)mmmm[2018.06.08]Months as the first letter of the month
| param x: | Date to be formatted |
|---|---|
| returns: | month |
q)mmmmm[2018.06.08]Days as 1-31
| param x: | Date to be formatted |
|---|---|
| returns: | Date |
q)d[2018.06.08]Days as 01-31
| param x: | Date to be formatted |
|---|---|
| returns: | Date |
q)dd[2018.06.08]To get Days as Sunday-Saturday
| param x: | Date to be formatted |
|---|---|
| returns: | Day of the week |
q)system"W 4"; dddd[2018.06.08]; system"W 2"q)system"W 0"; dddd[2018.06.08]; system"W 2"To get Days as Sun-Sat
| param x: | Date to be formatted |
|---|---|
| returns: | Day of the week |
q)system"W 4"; ddd[2018.06.08]; system"W 2"q)system"W 0"; ddd[2018.06.08]; system"W 2"To get Years as 1900-2099
| param x: | Date to be formatted |
|---|---|
| returns: | year |
q)yyyy[2018.06.08]To get Years as 00-99
| param x: | Date to be formatted |
|---|---|
| returns: | year |
q)yy[2018.06.08]To get Hours as 0-23
| param x: | Date to be formatted |
|---|---|
| returns: | Hours |
q)h 01:05:21To get Hours as 00-23
| param x: | Date to be formatted |
|---|---|
| returns: | Hours |
q)hh 01:05:21To get Hours as 1-12
| param x: | Date to be formatted |
|---|---|
| returns: | Hours |
q)h1 01:05:21q)h1 21:05:21To get Hours as 01-12
| param x: | Date to be formatted |
|---|---|
| returns: | Hours |
q)hh1 01:05:21q)hh1 21:05:21To get Minutes as 0-59
| param x: | Date to be formatted |
|---|---|
| returns: | Minutes |
q)u x:21:05:21.123To get Minutes as 00-59
| param x: | Date to be formatted |
|---|---|
| returns: | Minutes |
q)uu 01:05:21To get Seconds as 0-59
| param x: | Date to be formatted |
|---|---|
| returns: | seconds |
q)s x:01:05:21To get Seconds as 00-59
| param x: | Date to be formatted |
|---|---|
| returns: | seconds |
q)ss1 01:05:21To get Time as 4 AM
| param x: | Date to be formatted |
|---|---|
| returns: | AM/PM |
q)ampm0[21:05:21]To get Time as 4 A
| param x: | Date to be formatted |
|---|---|
| returns: | A/P |
q)ap0[21:05:21]To get Time as 4 am
| param x: | Date to be formatted |
|---|---|
| returns: | am/pm |
q)ampm[21:05:21]To get Time as 4 a (a/p)
| param x: | Date to be formatted |
|---|---|
| returns: | a/p |
q)ap[21:05:21]To get 3 digits millisecond precision
| param x: | Date to be formatted |
|---|---|
| returns: | milliseconds |
q)ms3[x:21:05:21.123]To get 2 digits millisecond precision
| param x: | Date to be formatted |
|---|---|
| returns: | milliseconds |
q)ms2[x:21:05:21.123]To get 1 digit millisecond precision
| param x: | Date to be formatted |
|---|---|
| returns: | millisecond |
q)ms1[x:21:05:21.123]