Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
New Member

Usage of Formate Date in CPO

Hi,

I need small help on Formate date activity. Below are the details:

Required output format:       MM'/'dd'/'yyyy hh:mm tt

Input: System date           ( 05.07.2012 17:25:39)

In the above formate, tt refers to AM/PM but i am unable see AP,PM in my output.

My output:  07/05/2012 05:25

Required output: 07/05/2012 05:25 PM.

Provide

Everyone's tags (2)
1 ACCEPTED SOLUTION

Accepted Solutions
Silver

Usage of Formate Date in CPO

In the first case, you have to use a format string that matches your input to "teach" the system how to convert an arbitrary string into something known as a piece of datetime data. 

The whole idea of Parse Date is to convert a string into a datetime.  [Server.Current Time] is already a datetime, so this is an unecessary step, but if you wanted to try it you'd have to use the right parser string.  For your datetime format,

06.07.2012 16:20 (UTC+02:00)

would be parsed properly with

dd.MM.yyyy HH:mm (UTCK)

As for the second scenario, some system cultures don't return AM/PM.  Can you try checking the checkbox to "Use specified culture..." and enter "en-US"?

(I'm a little concerned about this solving it, since you're also getting dots instead of slashes so it's like the formatter isn't doing anything)

4 REPLIES
Silver

Usage of Formate Date in CPO

You can pretty much feed any style of input string, but you have to "teach" CPO how to read it.

For your case, I tried the following and got your desired output.

Use the "Parse Date" activity first:

Format String = dd.MM.yyyy HH:mm:ss

Input String = 05.07.2012 17:25:39

Then use the "Format Date" activity next:

Format String = MM/dd/yyyy hh:mm tt

Original Date = [Workflow.Parse Date.Result]

New Member

Usage of Formate Date in CPO

Hi Michael,

Thanks for reply.

I have tried your scenario as follows:

Scenairio 1)

a)  Parse Date

format string : dd.MM.yyyy HH:mm:ss

Input string [Server.Current.Time] 

Failing with error message "String was not recognized as a valid DateTime." input is --- 06.07.2012 16:20 (UTC+02:00)

Scenario 2:

a) Parse date activity

Format String = dd.MM.yyyy HH:mm:ss

Input String = 05.07.2012 17:25:39

Then use the "Format Date" activity next:

Format String = MM/dd/yyyy hh:mm tt

Original Date = [Workflow.Parse Date.Result]

Out put: 07.05.2012 05:25

In 2nd scenario, / is replaced with . and it is not showing the AM and PM values in output.

I am using CPO 2.3.

Silver

Usage of Formate Date in CPO

In the first case, you have to use a format string that matches your input to "teach" the system how to convert an arbitrary string into something known as a piece of datetime data. 

The whole idea of Parse Date is to convert a string into a datetime.  [Server.Current Time] is already a datetime, so this is an unecessary step, but if you wanted to try it you'd have to use the right parser string.  For your datetime format,

06.07.2012 16:20 (UTC+02:00)

would be parsed properly with

dd.MM.yyyy HH:mm (UTCK)

As for the second scenario, some system cultures don't return AM/PM.  Can you try checking the checkbox to "Use specified culture..." and enter "en-US"?

(I'm a little concerned about this solving it, since you're also getting dots instead of slashes so it's like the formatter isn't doing anything)

New Member

Usage of Formate Date in CPO

Hi Michael,

The second scenario is worked with "en-US". Without using the parsing of date i am able to get the required solution.

Thanks for providing the solution.

629
Views
0
Helpful
4
Replies
CreatePlease to create content