How to provide timing in GMT format

Hi,
Anyone can you please explain how can I give time in GMT format in UiPath,
Now I’m providing current system date and time, If I want to get that in GMT format,
What I can do for it.

@Chippy_Kolot

  1. Assign activity:

    • currentDateTime (Variable type: System.DateTime) = Now
  2. Assign activity:

    • gmtDateTime (Variable type: System.DateTime) = currentDateTime.ToUniversalTime()
  3. Assign activity:

    • gmtDateTimeString (Variable type: System.String) = gmtDateTime.ToString(“yyyy-MM-dd HH:mm:ss”)

Hi @Chippy_Kolot

Try this syntax:

DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss",System.Globalization.CultureInfo.InvariantCulture)


Hope it helps!!
Regards,

Hi @Chippy_Kolot

  1. In the “To” field of the Assign activity, enter the variable name where you want to store the time in GMT format (e.g., “gmtTime”).
  2. In the “Value” field, enter the following expression:

gmtTime = DateTime.UtcNow.ToString(“yyyy-MM-dd HH:mm:ss”)

Hope it helps!!

@Chippy_Kolot

This should help

DateTime.UtcNow

Cheers

Hi @Chippy_Kolot

Try this

Date=DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss",System.Globalization.CultureInfo.InvariantCulture)

I hope it helps!!

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