Datetime.now

Hi,

I would like the date and time in this format (“dd/MM/yyyy HH:mm”),
but the output in Excel appears to be (“mm/dd/yyyy HH:mm”) instead.

I am using this string now: DateTime.Now.ToString(“dd/MM/yyyy HH:mm”)

@Joanna2 I think you need to change your format to (“en-GB”)

Hi, how i do change it?

Hi,

Can you try to add ' at the begining of the string as the following if it’s no problem recognized as text in the worksheet?

"'"+DateTime.Now.ToString(“dd/MM/yyyy HH:mm”)

Regards,

@Joanna2

Ideally the excel column format determines the date format…so use format cell and change the firmat or use a predefined template

Or the other way would be to add a single literal(') before the date and it would be considered as text by excel and would fisplay exactly same

Datetime.Now.ToString("'dd/MM/yyyy HH:mm")

Cheers

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.