Expand my Community achievements bar.

SOLVED

getTimeParting 6.2, how can I get month in numeric?

Avatar

Level 2

Previously we were getting 9/27/2023|4:02 AM|Wednesday this format, Now with the 6.2 version the output is year=2023 | month=September | date=27 | day=Wednesday | time=11:35 PM.

I tired different things but unable to get month in numeric format.

any tips?

 

Also explain  a = /([a-zA-Z]+).*?([a-zA-Z]+).*?([0-9]+).*?([0-9]+)(.*?)([0-9])(.*)/.exec(a);

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Looks like the plug-in did away with your old format since its version 4.0 update in August 2016. To get back your desired value, you'll need to use some custom code to convert the plug-in's returned values to what you want.

Something like this:

 

// use this inside your AA extension's custom code's doPlugins section
const monthNames = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
const timePartingString = s.getTimeParting();
const timePartingParts = timePartingString.split('|').map((value) => value.split('=')[1].trim());
const [timePartingYear, timePartingMonth, timePartingDay, timePartingDayOfWeek, timePartingTime] = timePartingParts;
s.eVarXX = `${monthNames.indexOf(timePartingMonth) + 1}/${timePartingDay}/${timePartingYear}|${timePartingTime}|${timePartingDayOfWeek}`;

 

 

Please test this code properly before publishing it to live!

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

Looks like the plug-in did away with your old format since its version 4.0 update in August 2016. To get back your desired value, you'll need to use some custom code to convert the plug-in's returned values to what you want.

Something like this:

 

// use this inside your AA extension's custom code's doPlugins section
const monthNames = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
const timePartingString = s.getTimeParting();
const timePartingParts = timePartingString.split('|').map((value) => value.split('=')[1].trim());
const [timePartingYear, timePartingMonth, timePartingDay, timePartingDayOfWeek, timePartingTime] = timePartingParts;
s.eVarXX = `${monthNames.indexOf(timePartingMonth) + 1}/${timePartingDay}/${timePartingYear}|${timePartingTime}|${timePartingDayOfWeek}`;

 

 

Please test this code properly before publishing it to live!