Changing Date Format Using PeopleCode

Your rating: None

Peoplesoft provides a function called as "DateTimeToLocalizedString" to change date from one format into another.

Following is syntax used to achiev this.

DateTimeToLocalizedString({datetime | date}, [Pattern])

Param1 : Variable of Date Datatype
Param2 : Date format which you want for example "dd/MM/yyyy".

If you have Param1 of type string then use function "DateValue" to convert that string to Date.

Please try to help out with unanswered topics on the forum. Chances are you have had the same issue/question some time in your IT career!

Comments

Have a question? Please ask it on the forum instead.

Re: Changing Date and Date time formate example

Posts: 302
Join date: 06/23/08
Lepa's picture

Here is an example on how we can apply the above function.

%date in as 2008-08-29 out as 20080829:

&date = DateTimeToLocalizedString(%Date, "yyyyMMdd");

%Datetime in as 2008-08-19-17.12.09.000000 out as 20080828-171209:

&datetime = DateTimeToLocalizedString(%Datetime, "yyyyMMdd-HHmmss");

Give back to the community and help it grow!
* Help with unanswered forum questions and issues
* Register or login to share your knowledge at your own blog

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <div> <pre> <br> <code> <a> <em> <blockquote> <strong> <ul> <ol> <li> <dl> <dt> <b> <p> <h1> <h2> <u> <img>
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>.

More information about formatting options

CAPTCHA
The question below is to prevent automated spam submissions.
2 + 15 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.