Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Denial
Contributor II
Contributor II

How to capture milli seconds When we use function datetime to convert to local time

Hi ,

 Facing issue When we use function datetime to convert to local time, the milli second information is not captured. All the values are populated with 000000.

Also we use Audit column value as datetime($AR_H_COMMIT_TIMESTAMP,'utc','+10 hours'), since local time need to be ingested.

 

Tried to use the below expression but i am not able to test expression 

datetime($AR_H_COMMIT_TIMESTAMP,'utc','+10 hours','yyyy-MM-dd hh:mm:ss.SSS')

 

Please Let me know how i can capture the details.

 

Thanks,

Labels (1)
1 Solution

Accepted Solutions
SachinB
Support
Support

Hello @Denial ,

You can use the strftime function to format a date and time value as a string with a specific format. To include milliseconds in the output, you can use the %f format code, which represents microseconds.

This will return the current date and time with microseconds, You can adjust the format string to match the format you need for your application.

strftime('%Y-%m-%d %H:%M:%f', 'now')

SachinB_0-1681733136621.png

Let us know hope this works for you.

Regards,

Sachin B

 

 

 

View solution in original post

5 Replies
john_wang
Support
Support

Hello @Denial ,

Thanks for reaching out.

The header part information is retrieved from source database transaction log, or Replicate calculates based on some other basic information, if the transaction log does not record such detailed information eg commit time in millisecond then Replicate cannot get it.

Could you please let us know the source database type ? We'd like to confirm for you.

thanks,

John.

Help users find answers! Do not forget to mark a solution that worked for you! If already marked, give it a thumbs up!
Denial
Contributor II
Contributor II
Author

Hi John 

 

The source we were trying for DB2 iseries

Thanks,

SachinB
Support
Support

Hello @Denial ,

You can use the strftime function to format a date and time value as a string with a specific format. To include milliseconds in the output, you can use the %f format code, which represents microseconds.

This will return the current date and time with microseconds, You can adjust the format string to match the format you need for your application.

strftime('%Y-%m-%d %H:%M:%f', 'now')

SachinB_0-1681733136621.png

Let us know hope this works for you.

Regards,

Sachin B

 

 

 

Denial
Contributor II
Contributor II
Author

Hi Sachin,

 

Thank you for your response , Yes it is working fine just a quick doubt as in the expression can we use UTC  time to capture. i tried but it is not working Can you confirm on this .

 

Thanks,

SachinB
Support
Support

Hello @Denial ,

Thanks for the update.

The one which is representing I believe that is UTC time only, As replicate consider default time as UTC.

 

Regards,

Sachin B