SOLVED

Re: How to format a date type?

Go to solution
Anonymous
Not applicable

How to format a date type?

Is there a way to format a date that I am calling to a landing page through tokens to depict it in DD-MMM-YY? MMM represents first three alphabets of a month - JAN, FEB, MAR etc.

Thanks in advance for your help.

Best regards,
Ajay
 

Tags (1)
1 ACCEPTED SOLUTION

Accepted Solutions
Anonymous
Not applicable

Re: How to format a date type?

One option would be the new custom formatting. 

Defining a custom field and using a regular expression for Change Data Value would work smoothly.

REGEX_REPLACE
Replaces patterns matched by a regex with a replacement string
 
Syntax:
##REGEX_REPLACE(<token or value>,"/<regular expression>/", <replacement token or value>)##
 
Example :
##REGEX_REPLACE("Hello *#&^ World","/^[A-Za-z0-0]/","_")##
returns "Hello ____ World"


In that context you can easily format as DD-Month-YY.

View solution in original post

7 REPLIES 7
Anonymous
Not applicable

Re: How to format a date type?

One option would be the new custom formatting. 

Defining a custom field and using a regular expression for Change Data Value would work smoothly.

REGEX_REPLACE
Replaces patterns matched by a regex with a replacement string
 
Syntax:
##REGEX_REPLACE(<token or value>,"/<regular expression>/", <replacement token or value>)##
 
Example :
##REGEX_REPLACE("Hello *#&^ World","/^[A-Za-z0-0]/","_")##
returns "Hello ____ World"


In that context you can easily format as DD-Month-YY.

Anonymous
Not applicable

Re: How to format a date type?

Way cool! Thanks for sharing this!!
Anonymous
Not applicable

Re: How to format a date type?

Sharing the other functions as well. While they are not directly related to that discussion they can be used for future reference

TRIM
Trims whitespace around the given value
 
Syntax:
Replaces patterns matched by a regex with a replacement string
##TRIM(<token or value>)##
 
Example:
##TRIM("   Hello World   ")##
returns "Hello World"
 
=============================
 
REPLACE
Replaces all occurrences of a given string within the given token/value
 
Syntax:
##REPLACE(<token or value>,<search token or value>, <replacement token or value>)##
 
Example :
##REPLACE("Hello My World","My","Your")##
returns "Hello Your World"
 
=============================
 
LEFT
Returns the first 'n' characters of the given token/value
 
Syntax:
##LEFT(<token or value>,n)##
 
Example :
##LEFT("Hello My World",7)##
returns "Hello M"
 
=============================
 
RIGHT
Returns the last 'n' characters of the given token/value
 
Syntax:
##RIGHT(<token or value>,n)##
 
Example :
##RIGHT("Hello My World",5)##
returns "World"
 
=============================
 
SUM
Returns sum of all arguments - can pass arbitrary number of arguments
If any argument is not a number, will log an error
 
Syntax:
##SUM(<token or value>,<token or value>,<token or value> ...)##
 
Example :
##SUM({{lead.Lead Score}},5,10)##
returns 25, assuming Lead Score was 10
 
Anonymous
Not applicable

Re: How to format a date type?

Hello Breno,
thank you for this post. I've been trying to search articles about these functions etc. but havent' been lucky with that, could you send a link to this ? I haven't found that here and not even on the developers.marketo.com.
Thank you,

Vaclav
David_Klein5
Level 1

Re: How to format a date type?

Do we have to do anything to enable these functions?  When I attenpt to use the SUM function I get an error "Not a valid integer"?
Grant_Booth
Level 10

Re: How to format a date type?

The functions Breno referred to were part of a beta product, which is not available to customers. I'm not certain it was ever generally available, and I think Breno may not have realized this. I don't think there's an out-of-the-box solution for this, and it would require using javascript to set a variable and then manipulate it before displaying. I'm not certain how to do this as it's outside my expertise, but I assume it can be done.
Anonymous
Not applicable

Re: How to format a date type?

Hi Grant,
I see that the response Brono wrote is more than a year old, is there some estimate when this feature would go live ??? Currently we're solving this problem with webhooks going outside where is some processing, but that takes a long time and needs a publicly available machine.