You are viewing this site as a guest. You can still ask questions and help others! Join our Dev2Dev IT Community to receive your own blog, share your knowledge, and much more.

Date display format on Page

3 replies [Last post]
gpawar.ps's picture
User offline. Last seen 10 years 31 weeks ago. Offline
Joined: 02/06/2009
Posts: 10

Hello,
We are facing strange issue.
On 'Employment' page date field (display only) is appearing as DD/MM/YYYY instead of MM/DD/YYYY.
I have checked PeopleTools > Personalisation > Locale Defaults > Date Format. But I didn't understand how to set it. (it is showing D, Y etc.)
- How to change Date display format as MM/DD/YYYY on page?
- Can we change Date display on page based on user? (i.e. diff. Date display format for diff. users)

Thank you in advance.

Regards,
Ganesh Pawar

Regards,
Ganesh Pawar

navinsahay's picture
User offline. Last seen 6 years 34 weeks ago. Offline
Joined: 04/24/2009
Posts: 6
Re: Date display format on Page

Hi! Ganesh

In Order to change the date format through Personalization, please follow the steps given below:

1. Navigate, Root > People Tools > Personalization > Personalization Options > Search

Here, you will get the option for the different application for which you want to change the Date Format or you can also choose PPTL (People Tools) which change the Date Format in the Tools itself. Select, PPTL.

2. Now, you can see there is a Definition---> DFRMT, for the Date Format.

3. On the Top of this page and beside the Definition Tab, you will find the Format Tab, just click on this Tab.

4. Now, click on the "Set Option Default Value".

5. Change the Option Default Value as per your requirement MMDDYY and click OK.

6. Save the changes.

========================================
========================================

If you want to change the Date Format for a Specific User on specific page then you can also do this through People Coding.

You can also play with the below code with the help of %oprid, like if %oprid then the below code or w.r.t roles through "IsUserInRole" function.

There is one built-in function "DateTimeToLocalizedString". You can use this if you want to change the date format through people code for your PIA pages.

How to use:

Example 1:
&String = DateTimeToLocalizedString(&Date, "M/d/y");
/* if you are picking the date from any record field and using &Date for that field */

Example 2:
&String = DateTimeToLocalizedString(%Date, "M/d/y");
/* if you want to pick the system date and want to use it on your page with different formats. */

-- Assign this String variable (&String) to your desired field.

Note: Here 'd' for date and 'y' for year both must be in smaller letters only. And, 'M' for months should be in Caps.

I hope the above resolutions will help you.

Regards
Navin Sahay

Peter.Wan's picture
User offline. Last seen 11 years 15 weeks ago. Offline
Joined: 08/13/2009
Posts: 9
Re: Date display format on Page

Check for User Role

A very handy PeopleCode function to check for a user role(s) and perform specific actions depending on the value returned.
Function RoleToMatch(&RoleToMatch) Returns boolean;

&bFound = False;
/*Returns an array containing all roles associated to the current user*/
&aRoles = %Roles;
/*Loop through the array*/
For &I = 1 To &aRoles.Len
&RoleName = &aRoles.Shift();
If Upper(LTrim(RTrim(&RoleName))) = Upper(LTrim(RTrim(&RoleToMatch))) Then
&bFound = True;
Break;
End-If;
End-For;
Return &bFound;
End-Function;

...and here is how to call the function
/*Note: Don't forget to declare your function before you call it*/
/* Declare variables
&aRoles is an array of string that will store roles from %roles */
Local array of string &aRoles;
Local number &I;
Local string &RoleName;
Local boolean &bFound;
/*Function Call*/
/*The role that I would like to validate if a user has is "Administrator"*/
If RoleToMatch("Administrator") Then
/*What you want to do goes here*/
End-If;

mayank's picture
mayank (not verified)
how can send email using php script & how can set configuration

Hello friend,

How can send email using php script & how can set configuration,
I have try many times to send email using php but till now i failed to send email.

Please give me solution in this probs.

thanks
xyz friends