Discussion

Converting Date to DateTime property

I am trying to populate a DateTime property with the value from a Date property using Property-Set method.

Primary.DateTimeProp = Page1.DateProp

The DateProp has a value of 20110207, for example. I expect a value of 20110207T000000.000 GMT in DateTimeProp after the execution of this step. However, what I get is 19700101T000000.000 GMT.

I will greatly appreciate if someone could help me fix this issue or tell me what I am doing wrong.

Thanks a lot.

**Moderation Team has archived post**

This post has been archived for educational purposes. Contents and links will no longer be updated. If you have the same/similar question, please write a new post.

Comments

Keep up to date on this post and subscribe to comments

August 11, 2011 - 8:27am

Usually this happens when we set a value to a 'Date' property and the value being set i.e. in your case 'Page1.DateProp' doesn't hold a value while the step executes. A pre condition would resolve this issue.

Thanks,
Venkat

February 24, 2011 - 1:16pm

Hi,

I have a similar issue. I hardcoded "T000000.000 GMT" but then I had to revert back since it was hardcoding. I then used @toDateTime function, but it added T050000.000 (guess since timezone is est).
I then had to do @addTime(.TodaysDate, 0, 0, 0, 0,true,Operator.pyCalendar) per out req and it added 8(Might be cuz out business day start time is 8am) to it and returned as 20110225T130000.000 GMT. I did not understand why it added T05 and 08 to T05.

I did not understand how @toDateTime and @addTime works exactly.

February 24, 2011 - 4:10pm

An understanding of the Java Date object would help you, and I have linked it for you here: http://download.oracle.com/javase/1.4.2/docs/api/java/util/Date.html

EST is actually GMT-5, but the actual value returned that you see in your clipboard depends upon where your PRPC server is, and not where Pegasystems server is.

February 7, 2011 - 6:15pm

Simplest thing to do is this:

Primary.DateTimeProp = Page1.DateProp + "T000000.000 GMT"

:-)

February 7, 2011 - 6:37pm

Is hardcoding a good idea?
Thanks,

August 16, 2016 - 10:45pm

Primary.DateTimeProp = Page1.DateProp + "T000000.000 GMT" - This worked Perfectly, thanks!!