{"id":10170,"date":"2016-02-25T09:51:58","date_gmt":"2016-02-25T01:51:58","guid":{"rendered":"http:\/\/localhost\/help\/p2-server\/calculations\/format\/"},"modified":"2024-01-17T10:48:02","modified_gmt":"2024-01-17T02:48:02","slug":"format","status":"publish","type":"page","link":"https:\/\/oihelp.corporate.ifs.com\/help\/p2-server\/calculations\/format\/","title":{"rendered":"Format()"},"content":{"rendered":"\n<h2><span id=\"Format\">Format<\/span><\/h2>\n<p class=\"intro-text\"><strong>Format(Time ,FormatString [,TimeZone])<\/strong><\/p>\n<h2><span id=\"Returns\">Returns<\/span><\/h2>\n<p class=\"intro-text\">Formats the supplied time argument in the specified format.<\/p>\n<h2><span id=\"Parameters\">Inputs<\/span><\/h2>\n<p class=\"intro-text\"><strong>Time<\/strong>: The time argument to be formatted.<br \/>\nBehaviour: Required<br \/>\nDimension: Collection, SingleValue, MultiCollection<br \/>\nValid\u00a0data types: DateTime, Decimal, Integer, String<\/p>\n<p class=\"intro-text\"><strong>FormatString<\/strong>: The string specifying how to format the time.\u00a0<br \/>\nBehaviour:\u00a0Required<br \/>\nDimension: Collection, SingleValue<br \/>\nValid data types: String<\/p>\n<p class=\"intro-text\"><b>TimeZone<\/b>: The geographical or UTC offset time zone (e.g. \"Australia\/Perth\" or \"UTC+08:00\"). If not supplied, it assumes the configured calendar time zone.<br \/>\nBehaviour: Optional<br \/>\nDimensions: SingleValue<br \/>\nValid data types: String<\/p>\n<p class=\"left-bar\"><a href=\"https:\/\/oihelp.corporate.ifs.com\/help\/p2-server\/calculations\/calculation-syntax\/#Data_Type\">How to format data types<\/a><\/p>\n<h2>Format Codes<\/h2>\n<p class=\"intro-text\">The following codes within the FormatString are replaced with the relevant information. The codes are not case sensitive.<\/p>\n<ul>\n<li class=\"intro-text\">The codes must be in quotation marks. E.g. \"Day\"<\/li>\n<li class=\"intro-text\">You may concatenate the codes to produce the desired string. E.g. \"DayMonth\"<\/li>\n<li class=\"intro-text\">You may include other text, spaces, and punctuation within the quotation marks. E.g. \"Day, Month\"<\/li>\n<li class=\"intro-text\">Any other text within the quotation marks\u00a0is converted to upper case.<\/li>\n<\/ul>\n<table>\n<tbody>\n<tr style=\"border: 1px solid #cccccc;\">\n<td style=\"padding-left: 5px;\" width=\"81\"><strong>DDD<\/strong><\/td>\n<td width=\"373\">Day of year (001 to 366)<\/td>\n<\/tr>\n<tr style=\"border: 1px solid #cccccc;\">\n<td style=\"padding-left: 5px;\" width=\"81\"><strong>DAY<\/strong><\/td>\n<td width=\"373\">Full weekday name<\/td>\n<\/tr>\n<tr style=\"border: 1px solid #cccccc;\">\n<td style=\"padding-left: 5px;\" width=\"81\"><strong>DY<\/strong><\/td>\n<td width=\"373\">Abbreviated weekday name, e.g. FRI<\/td>\n<\/tr>\n<tr style=\"border: 1px solid #cccccc;\">\n<td style=\"padding-left: 5px;\" width=\"81\"><strong>MONTH<\/strong><\/td>\n<td width=\"373\">Full month name<\/td>\n<\/tr>\n<tr style=\"border: 1px solid #cccccc;\">\n<td style=\"padding-left: 5px;\" width=\"81\"><strong>MON<\/strong><\/td>\n<td width=\"373\">Abbreviated month name, e.g. AUG<\/td>\n<\/tr>\n<tr style=\"border: 1px solid #cccccc;\">\n<td style=\"padding-left: 5px;\" width=\"81\"><strong>HH12<\/strong><\/td>\n<td width=\"373\">Hour in 12 hour format (1 - 12)<\/td>\n<\/tr>\n<tr style=\"border: 1px solid #cccccc;\">\n<td style=\"padding-left: 5px;\" width=\"81\"><strong>HH<\/strong><\/td>\n<td width=\"373\">Hour in 12 hour format (1 - 12)<\/td>\n<\/tr>\n<tr style=\"border: 1px solid #cccccc;\">\n<td style=\"padding-left: 5px;\" width=\"81\"><strong>HH24<\/strong><\/td>\n<td width=\"373\">Hour in 24 hour format (00 - 23)<\/td>\n<\/tr>\n<tr style=\"border: 1px solid #cccccc;\">\n<td style=\"padding-left: 5px;\" width=\"81\"><strong>YYYY<\/strong><\/td>\n<td width=\"373\">Four-digit year<\/td>\n<\/tr>\n<tr style=\"border: 1px solid #cccccc;\">\n<td style=\"padding-left: 5px;\" width=\"81\"><strong>A.M.<\/strong><\/td>\n<td width=\"373\">AM or PM indicator<\/td>\n<\/tr>\n<tr style=\"border: 1px solid #cccccc;\">\n<td style=\"padding-left: 5px;\" width=\"81\"><strong>AM<\/strong><\/td>\n<td width=\"373\">AM or PM indicator<\/td>\n<\/tr>\n<tr style=\"border: 1px solid #cccccc;\">\n<td style=\"padding-left: 5px;\" width=\"81\"><strong>P.M.<\/strong><\/td>\n<td width=\"373\">AM or PM indicator<\/td>\n<\/tr>\n<tr style=\"border: 1px solid #cccccc;\">\n<td style=\"padding-left: 5px;\" width=\"81\"><strong>PM<\/strong><\/td>\n<td width=\"373\">AM or PM indicator<\/td>\n<\/tr>\n<tr style=\"border: 1px solid #cccccc;\">\n<td style=\"padding-left: 5px;\" width=\"81\"><strong>WW<\/strong><\/td>\n<td width=\"373\">Week of year, if Sunday is the first day of the week<\/td>\n<\/tr>\n<tr style=\"border: 1px solid #cccccc;\">\n<td style=\"padding-left: 5px;\" width=\"81\"><strong>IW<\/strong><\/td>\n<td width=\"373\">Week of year, if Monday is the first day of the week<\/td>\n<\/tr>\n<tr style=\"border: 1px solid #cccccc;\">\n<td style=\"padding-left: 5px;\" width=\"81\"><strong>DD<\/strong><\/td>\n<td width=\"373\">Day of month (01 to 31)<\/td>\n<\/tr>\n<tr style=\"border: 1px solid #cccccc;\">\n<td style=\"padding-left: 5px;\" width=\"81\"><strong>MM<\/strong><\/td>\n<td width=\"373\">Month (01 to 12)<\/td>\n<\/tr>\n<tr style=\"border: 1px solid #cccccc;\">\n<td style=\"padding-left: 5px;\" width=\"81\"><strong>MI<\/strong><\/td>\n<td width=\"373\">Minutes (00 to 59)<\/td>\n<\/tr>\n<tr style=\"border: 1px solid #cccccc;\">\n<td style=\"padding-left: 5px;\" width=\"81\"><strong>SS<\/strong><\/td>\n<td width=\"373\">Seconds (00 to 59)<\/td>\n<\/tr>\n<tr style=\"border: 1px solid #cccccc;\">\n<td style=\"padding-left: 5px;\" width=\"81\"><strong>D<\/strong><\/td>\n<td width=\"373\">Day of week<\/td>\n<\/tr>\n<tr style=\"border: 1px solid #cccccc;\">\n<td style=\"padding-left: 5px;\" width=\"81\"><strong>IY<\/strong><\/td>\n<td width=\"373\">Two-digit year (00 to 99)<\/td>\n<\/tr>\n<tr style=\"border: 1px solid #cccccc;\">\n<td style=\"padding-left: 5px;\" width=\"81\"><strong>YY<\/strong><\/td>\n<td width=\"373\">Two-digit year (00 to 99)<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<h2><span id=\"Examples\">Examples<\/span><\/h2>\n<p class=\"intro-text\">Expression:\u00a0<span class=\"code-fragment\">Format(Time(), \"MON\")<\/span><br \/>\nResult: Format the date returned by the <em>Time()<\/em>\u00a0expression, as the abbreviated month name. <br \/>\nE.g. <span style=\"color: #0000ff;\">Jul<\/span><\/p>\n<p class=\"intro-text\">Expression:\u00a0<span class=\"code-fragment\">Format(TimeOf({entity[Field]:Gas.Flowrate}), \"DD-MON-YYYY\")<\/span><br \/>\nResult: Format the date returned by the <em>TimeOf()<\/em> expression, as the day of month, abbreviated month name, and four-digit year. <br \/>\nE.g. <span style=\"color: #0000ff;\">13-Jul-2016<\/span><\/p>\n<p class=\"intro-text\">Expression: <span class=\"code-fragment\">Format({tagname}, \"DD HH24:MI\")<\/span><br \/>\nResult: Format the time of the supplied tag as a day and time. <br \/>\nE.g. <span style=\"color: #0000ff;\">13 13:42<\/span><\/p>\n<p class=\"intro-text\">Expression: <span class=\"code-fragment\">Format(CalendarDayStart(January(Time())), \"HH24:MI:SS DD-MON-YYYY\")<\/span><br \/>\nResult: Format the time\u00a0returned by the <em>CalendarDayStart()<\/em>\u00a0expression, as a timestamp with the time followed by the date. <br \/>\nE.g. <span style=\"color: #0000ff;\">00:00:00 01-Jan-2016<\/span><\/p>\n<p class=\"intro-text\">Expression: <span class=\"code-fragment\">Format(Time(), \"DAY DD MONTH, YYYY HH24:MI:SS\")<\/span><br \/>\nResult: Format the time\u00a0returned by the <em>Time()<\/em>\u00a0expression, as a timestamp with the date followed by the time. <br \/>\nE.g. <span style=\"color: #0000ff;\">Wednesday\u00a013\u00a0July, 2016 13:42:21<\/span><\/p>\n<p class=\"intro-text\">Expression: <span class=\"code-fragment\">Format(1232256720.0, \"DD\/MM\/YY HH24:MI:SS\")<\/span><br \/>\nResult: Format the supplied time (in seconds\u00a0since epoch) as a timestamp with the date followed by the time. <br \/>\nE.g. <span style=\"color: #0000ff;\">18\/01\/09 14:32:00<\/span><\/p>\n<p class=\"intro-text\">Expression: <span class=\"code-fragment\">Format({utc'2017-06-15 00:00'}, \"DAY HH24:MI\", \"Australia\/Perth\")<\/span><br \/>\nResult: Format the supplied time as a time in the specified time zone. Examples:<br \/>\nFor time zone <em>Australia\/Perth<\/em>: <span style=\"color: #0000ff;\">Thursday 08:00<br \/>\n<\/span>For time zone <em>Europe\/Budapest<\/em>: <span style=\"color: #0000ff;\">Thursday 02:00<br \/>\n<\/span>For time zone <em>America\/Denver<\/em>:\u00a0<span style=\"color: #0000ff;\">Wednesday\u00a018:00<br \/>\n<\/span><\/p>\n<h2><span id=\"Release_History\">Release History<\/span><\/h2>\n<ul class=\"intro-text\">\n<li>Format() 4.6.5\n<ul class=\"intro-text\">\n<li>Changed Time parameter to support MultiCollection values.<\/li>\n<\/ul>\n<\/li>\n<li>Format() 4.0\n<ul class=\"intro-text\">\n<li>Initial version<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Use Format() to format the supplied time argument in a particular way.<\/p>\n<p class=\"continue-reading-button\"> <a class=\"continue-reading-link\" href=\"https:\/\/oihelp.corporate.ifs.com\/help\/p2-server\/calculations\/format\/\">Read more<i class=\"crycon-right-dir\"><\/i><\/a><\/p>\n","protected":false},"author":1,"featured_media":10173,"parent":3650,"menu_order":119,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":"","_members_access_role":[],"_members_access_error":""},"categories":[9],"tags":[100,397,396],"class_list":["post-10170","page","type-page","status-publish","has-post-thumbnail","hentry","category-tech-ref","tag-calculations","tag-casting-functions","tag-format","Version-4-0","Version-4-6-5","Product-srv"],"_links":{"self":[{"href":"https:\/\/oihelp.corporate.ifs.com\/help\/wp-json\/wp\/v2\/pages\/10170","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/oihelp.corporate.ifs.com\/help\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/oihelp.corporate.ifs.com\/help\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/oihelp.corporate.ifs.com\/help\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/oihelp.corporate.ifs.com\/help\/wp-json\/wp\/v2\/comments?post=10170"}],"version-history":[{"count":2,"href":"https:\/\/oihelp.corporate.ifs.com\/help\/wp-json\/wp\/v2\/pages\/10170\/revisions"}],"predecessor-version":[{"id":64740,"href":"https:\/\/oihelp.corporate.ifs.com\/help\/wp-json\/wp\/v2\/pages\/10170\/revisions\/64740"}],"up":[{"embeddable":true,"href":"https:\/\/oihelp.corporate.ifs.com\/help\/wp-json\/wp\/v2\/pages\/3650"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/oihelp.corporate.ifs.com\/help\/wp-json\/wp\/v2\/media\/10173"}],"wp:attachment":[{"href":"https:\/\/oihelp.corporate.ifs.com\/help\/wp-json\/wp\/v2\/media?parent=10170"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/oihelp.corporate.ifs.com\/help\/wp-json\/wp\/v2\/categories?post=10170"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/oihelp.corporate.ifs.com\/help\/wp-json\/wp\/v2\/tags?post=10170"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}