1. Roland Smith
  2. PowerBuilder
  3. Friday, 27 August 2021 01:06 AM UTC

The help topic 'standard datatypes' says this about the Time datatype:

The time in 24-hour format, including the hour (00 to 23), minute (00 to 59), second (00 to 59), and fraction of second (up to six digits), with a range from 00:00:00 to 23:59:59.999999.

The 'time display formats' help topic says this:

ffffff - Microseconds with no leading zeros. You can enter one to six f's; each f represents a fraction of a second (must follow s or ss)

 

The following code only shows three digits with zeros for the final three.

String ls_time
Time lt_Current

lt_Current = Now()

ls_time = String(lt_Current, "hh:mm:ss.ffffff")

MessageBox("Current", ls_time)

 

I get the same result for DateTime.

 

My question is: Is the help file wrong or does the String function have a bug?

 

Sivaprakash BKR Accepted Answer Pending Moderation
  1. Monday, 30 August 2021 08:41 AM UTC
  2. PowerBuilder
  3. # 1

Roland, 

Have you tried to get the time from the DBMS ?   Below is the query to get the current UTC time from PostgreSQL.

Select today_now
into :ls_curr_db_date
From (Select Cast(now() at time zone 'utc' as varchar) as today_now) a;

If you want system's datetime

Select today_now
into :ls_curr_db_date
From (Select Now() as today_now ) a ;

This gives you milliseconds with 6-7 places.  

HTH

Happiness Always
BKR Sivaprakash

 

Comment
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Friday, 27 August 2021 01:58 AM UTC
  2. PowerBuilder
  3. # 2
Comment
  1. Roland Smith
  2. Friday, 27 August 2021 02:35 AM UTC
That is what I thought but today I was looking at documentation for C# and I saw where it claimed to have 7 places. I just checked again and it says 3. I must have been looking at a different page that had it wrong.
  1. Helpful
  1. Chris Pollach @Appeon
  2. Friday, 27 August 2021 02:48 AM UTC
Yes, PB's time is "HH:MM:SS:TTT" or up to 999/1000 of a second.
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.