Friday, August 21, 2009

PeopleCode Time formatting

Had a record with a Time field, took a little while to figure out how to format the value since you can't pass a Time value directly into the builtin DateTimeToLocalizedString function.

/* &time is a record field defined as Time */
Local datetime &dateTime = DateTime6(1900, 1, 1, Hour(&time), Minute(&time), Second(&time));
Local string &formattedTime = DateTimeToLocalizedString(&dateTime, "h:mm a");


Jim Marion said...

I've fought that battle myself John. Here is how I get a DateTime value DateTimeValue("01/01/1900 " | &time)

John Wagenleitner said...

Thanks Jim, you code is much more succinct than mine.

Unknown said...

This is a very nice blog,I have seen this variety of post after a elongated moment. I value your endeavor for compiling such post.
Dissertation Editing


Unknown said...

I would really like your post ,it would really explain each and every point clearly well thanks for sharing.
Chevy HHR Turbo

gholi said...

Now there is a group blogging system gone live at it will help all people to get in touch with similar minded people around us. You can easily paste your posts there as well to be more heard.

Anonymous said...

An excellent post..really too interesting nice to go through thsi and have some useful points.
web designing company

yajur said...

interesting blog. It would be great if you can provide more details about it. Thanks you

Agile Software Development

Unknown said...

All the information that you have provided are 100 percent worthy of forwarding. Do you have any newsletters that I can subscribe to? I would very much like to keep abreast of your blog articles. I am a blogger too! You can see some of my job postings and sample articles at,online marketing videos. I will be grateful for your valuable comments. Please check out my stuff and post me your feedback.

Anonymous said...

Thanks for the code that you shared..Software & IT Training is really important to become a good coder.

sheikh said...

We are up for taking software development projects if you have something good to outsource.
assisted living website developer