You are viewing limited content. For full access, please sign in.

Question

Question

Remove Seconds from Retrieved Date/Time field for comparison in Conditional Expression

asked on June 11, 2014

I am retrieving a Date/Time field from a populated template field.

Then, I am comparing this against a date/time field from a database query to see whether the data I have is the newest iteration.

The problem, when I compare the two fields, is that the date format from the Lasefiche template is displayed as  mm/dd/yyyy HH:mm:ss    The value from the database displays as just Hours and minutes, thus in my conditional statement I never receive a match.

Ex.

[FALSE] Entry Token [RetrieveFieldValues_LSTUPD]:  '6/11/2014 5:37:18 AM' <equals> '6/11/2014 5:37 AM'

 

How do I either pattern match or otherwise create a token that can will have seconds removed from the data for comparison purposes ?

I am assuming I can just apply a pattern to the retrieved value, and use this token as my comparison value.

Can someone provide a quick solution ?

 

Thanks much !

cb

 

0 0

Answer

SELECTED ANSWER
replied on June 11, 2014

Instead of M/d/yyyy H:mm tt try M/d/yyyy h:mm (or M/d/yyyy hh:mm if you want a leading zero like 01:25 pm). If you look at the table for custom formats in the  documentation, h is used for 1-12 hour format, while H is used for 0-24 hour format.

0 0

Replies

replied on June 11, 2014 Show version history

Right click on the token you're pulling from the template and select "Token Editor". From this menu you can apply token formatting that can change the date into whatever format you'd like, just click on the ? icon to read a comprehensive help file that explains the required syntax.

 

 

In this case I've used the formatting pattern "M/d/yyyy H:mm tt". There are some variations you can make to that pattern (such as replacing "d" with "dd" to add a leading zero to the day, etc.) that are explained in the above mentioned help file. 

0 0
replied on June 11, 2014

Thanks VERY MUCH.  This was exactly what i needed !

0 0
replied on June 11, 2014

Aaron:

I didn't see in the help file what to do if I am trying to convert my values from military time (24-hour clock) to 12-hour.

In my case, my token produces 13:25 in the afternoon when I need to deliver 1:25 for comparison purposes.

Is there a token pattern  I can put on the value that parses this out the way I need it ?

 

have tried multiple iterations with no success.

thx

0 0
SELECTED ANSWER
replied on June 11, 2014

Instead of M/d/yyyy H:mm tt try M/d/yyyy h:mm (or M/d/yyyy hh:mm if you want a leading zero like 01:25 pm). If you look at the table for custom formats in the  documentation, h is used for 1-12 hour format, while H is used for 0-24 hour format.

0 0
replied on January 6, 2015 Show version history

I use pattern matching (\S+) on my dates to drop the hours and minutes. If you're looking for a match, it's rare you'd get an exact match on that specific criteria.

 

 

ETA: Sorry - you were just looking to cut off the seconds. This should work for that:

(\S+ \S+):\d\d

 

\S+ is a sequence of non-white space characters - so it lumps everything before the space. The next one lumps everything before the next space, so it would take all characters before the AM or PM, but then the () group the items you want to capture and the :\d\d are the last 2 decimal digits so putting the ) before the :\d\d cuts off the last 2 decimal digits of the sequence.

 

 

Ok, and then to add the AM or PM - I'd throw in the Date Time again and apply:

\S+ \S+ (\w\w)

Geez that is really making it complicated :)

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.