PgSqlTimeStamp Formatting

PgSqlTimeStamp Formatting

Postby JORGEMAL » Tue 18 May 2010 23:14

I wonder if this is a question for you.

I have a PgSqlTimeStamp value that is assigned to a textbox control but I want to format it so it appears as dd/mm/yyyy hh:mm:ss.
The time portion should display AM/PM.

I have used the following code but I am sure there must be a better option:
txtFechaReg.Text = SeccEspMedia.FechaReg.Day.ToString() + "/" +
SeccEspMedia.FechaReg.Month.ToString() + "/" + SeccEspMedia.FechaReg.Year.ToString() + " " +
SeccEspMedia.FechaReg.Hour.ToString() + ":" + SeccEspMedia.FechaReg.Minute.ToString() + ":" +
SeccEspMedia.FechaReg.Second.ToString();

Respectfully,
Jorge Maldonado
JORGEMAL
 
Posts: 165
Joined: Thu 03 Jul 2008 23:55

Postby Shalex » Thu 20 May 2010 23:22

Current format is defined basing on the regional settings of your operating system. But you can set the necessary format of the date/time representation using the PgSqlTimeStamp.ToString(format) overload. Description of the PostgreSQL to_char function is here .
Shalex
Devart Team
 
Posts: 7792
Joined: Thu 14 Aug 2008 12:44


Return to dotConnect for PostgreSQL