We recently added timestamp validation to InFlight’s SSO for PeopleSoft. One part of this was developing the PeopleCode functions to convert to and from Unix time (a.k.a Unix epoch time, Unix timestamp).You can find out more about Unix time here, but it’s basically a way of expressing a timestamp as an integer, in a way that’s independent of time zone. The value itself is the number of seconds (or sometimes, milliseconds) elapsed since midnight UTC, January 1, 1970.Here's the validation peoplecode (note the If (false) Then block in there if you want to do some debugging)Function GetUnixTimestampForDatetime(&localDateTime As datetime, &expressInMilliseconds As boolean) Returns number rem Ensure you have the server time zone set up correctly in PeopleTools > Utilities > Administration > PeopleTools Options ; rem Any change requires an App Server bounce; Local datetime &epoch = DateTime6(1970, 1, 1, 0, 0, 0); Local datetime &inputDateTimeUTC = DateTimeToTimeZone(&localDateTime, "Base", "UTC"); If ( False) Then %Response.Write("Epoch: " | String(&epoch) | "<br />"); %Response.Write("ServerTimeZone: " | %ServerTimeZone | "<br />"); %Response.Write("&inputDateTimeUTC: " | String(&inputDateTimeUTC) | "<br />"); End-If; rem DateTime - DateTime in PeopleCode returns number of seconds; Local number &unixTimestamp = &inputDateTimeUTC - &epoch; If (&expressInMilliseconds) Then &unixTimestamp = &unixTimestamp * 1000; End-If; Return &unixTimestamp; End-Function; /* Usage: Local number &serverTimestampInMilliseconds = GetUnixTimestampForDatetime(%Datetime, True); or Local number &serverTimestampInSeconds = GetUnixTimestampForDatetime(%Datetime, False); */Enjoy! Share via: More