Date format from yyyy-mm-dd to dd-mm-yyyy with

Lanre Ololade
Tera Contributor

I am trying to know how do i change the date format from yyyy-mm-dd format to dd-mm-yyyy format using validation regex?

1 ACCEPTED SOLUTION

I am trying to change the date format on a task I am working on. Will the code only apply to the task i am trying to complete or will it affect evrything on the system?

View solution in original post

5 REPLIES 5

-O-
Kilo Patron

Can you provide a little bit more context, a description of the actual problem you are trying to solve?
Where and for what purpose do you want to do this?

Ankur Bawiskar
Tera Patron

@Lanre Ololade 

what's your actual business requirement?

If my response helped please mark it correct and close the thread so that it benefits future readers.

AshishKM
Kilo Patron

Hi @Lanre Ololade , 

I dont think we can change dateformat via regex, as regex is checking the input value based on given pattern but not changing the input.

 

You can change the dateFormat using the getByFormat() method. Check the below code.

 

 

var gd = new GlideDate();
gs.info("Default  "+gd);
var formattedDate = gd.getByFormat('dd-MM-yyyy');
gs.info("dd-MMYYYY " +formattedDate);

 

AshishKM_0-1737602861421.png

 

-Thanks,

AshishKM

I am trying to change the date format on a task I am working on. Will the code only apply to the task i am trying to complete or will it affect evrything on the system?