Formatting a datetime referring to a 24-hours clock

pmscorca 1,007 Reputation points
2024-06-29T10:39:24.92+00:00

Hi,

in an ADF pipeline I'm trying to use this expression:

@formatDateTime(utcNow(),'yyyy-MM-ddTHH:mm:ss')

but this return a value that shows the AM/PM indicator.

I'd like to show the time referring to the 24-hours clock.

Any suggests to me, please? Thanks

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
10,800 questions
{count} votes

1 answer

Sort by: Most helpful
  1. AnnuKumari-MSFT 33,151 Reputation points Microsoft Employee
    2024-07-01T10:31:57.8866667+00:00

    Hi pmscorca ,

    Thankyou for posting your query on Microsoft Q&A platform .

    I understand from your query that you want to fetch the current time and display in 24-hour clock format without the AM/PM indicator.

    The formatDateTime function in Azure Data Factory (ADF) can be used to format the current date and time in a specific format.

    The format for a 24-hour clock time is HH:mm:ss.

    Ensure you use HH for hours in 24-hour format (from 00 to 23) instead of hh, which is for hours in 12-hour format (from 01 to 12).

    The expression which you are using is correct and should be giving the output in 24-hour format. I tried to reproduce the same and got the expected result.

    Case1: Using HH for hours
    User's image

    Case2: Using hh for hours

    User's image

    Hope it helps. Please let us know if you have further questions.

    Kindly mark the answer as accepted if it helped. Thankyou


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.