Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
pmscorca
Post Prodigy
Post Prodigy

Formatting a custom datetime colums referring to a 24-hours clock in a copy activity

Hi,

I'm implementing a data pipeline and I'm using a copy activity adding a custom datetime column to save in the destination the load data date.

For this column I'm using this expression:

 

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

 

that returns an undesidered AM/PM indicator.

Viewing the input information of the related Fabric data pipeline I can see this:

 

pmscorca_2-1719953056194.png

but in the Fabric lakehouse I can see this:

pmscorca_4-1719953119138.png

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

Any helps to me, please? Thanks

8 REPLIES 8
frithjof_v
Super User
Super User

@pmscorca it seems your Lakehouse column is text type (ABC). 

 

Do you want the Lakehouse column to be text type or datetime type?

 

If you actually want it to be text type, could you write the code like this?

 

'yyyy-MM-dd HH:mm:ss'

 

(Only change is to remove the T. Just to try if this changes something).

 

 

If the Lakehouse column was datetime type, maybe your local settings on the computer or web browser determines how the Lakehouse explorer displays the values. 

Hi,

I'm trying to add a custom datetime column in a copy activity to add this data to the source data to copy in a lakehouse; so, it should be the copy activity to establish automatically the right data type for the destination datetime column.

It is correct to use 'HH' in uppercase to obtain a time that refers to a 24-hours clock; writing 'yyyy-MM-ddTHH:mm:ss' with or without the T letter is the same thing.

It seems that I've solved at least partially, perhaps for a Fabric update.

I think that the copy activity should establish the right data type for the columns of the destination lakehouse table, if it doesn't exist. The formatDateTime function write a varchar(8000) column into a lakehouse and not a datetime/timestamp column and this is an undesirable behaviour.

 

Have you tried just using this formula:

 

@utcNow()

 

Perhaps this creates a date/time column in the Lakehouse table.

I can make it work (get date or date/time data type) by doing like this:

 

Source:

frithjof_v_0-1720193201442.png

 

Mapping:

frithjof_v_1-1720193312794.png

 

 

It is now a date/time column in the Lakehouse table (but still displaying PM symbol). 

frithjof_v_2-1720193377470.png

 

In the SQL Analytics Endpoint it is not displaying AM/PM. There it is being displayed in 24 hour-format, and with higher precision (microsecond, i.e. six digits behind the second).

 

So I guess the AM/PM format is just the display format which is being used in the Lakehouse explorer. Unless anyone knows how to change that display format (maybe some kind of regional settings). 

 

 

Example of Lakehouse Explorer:

frithjof_v_4-1720194417822.png

Same data viewed in SQL Analytics Endpoint:

frithjof_v_3-1720194391717.png

 

Doing New mapping, the dynamic mapping would be lost.

New mapping means custom mapping.

Anonymous
Not applicable

Hi @pmscorca 

 

I think this may have something to do with the date/time format of utcnow().

 

You can try changing utcnow () to now ().

 

 

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

 

 

Let me know if you have any questions.

 

Regards,

Nono Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi,

I obtain this error:

pmscorca_0-1720101172559.png


Also writing Now().



Anonymous
Not applicable

Hi @pmscorca 

 

In an expression, HH indicates the 24-hour format, not the 12-hour format.


If you still see AM/PM indicators, it may be due to the way data is interpreted or displayed in the Fabric lakehouse.


I suggest you check the following:

 

Data types: Make sure that the columns in the Fabric lakehouse are set to date-time types that support 24-hour formats.


Pipeline configuration: Carefully review the Settings of the replication activity to ensure that there are no conversions or Settings that change the date-time format.

 

Regards,

Nono Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors