Solved Date Time in Now() not the actual time

Hello, as the title says, when using the function Now() to get the actual time, im getting the the wrong hour, like 3 hours of differences. How can i configure this? the system machine has the right date time configuration so i dont think thats the problem, also i tried this on a different machine, and got the same issue. So i think is something that needs to be configure in blue prism
Thanks for your help.

Andres
 
Hi Dawson, thanks for your response,
Local Time() does return the actual real hour. But the problem is that im reading the received time from an email, and the time in that data item have the same problem, can i subtract the 3 hours difference using date or time variables?
Thanks
 

RDawson9

Geek
Staff member
Still intrigued to understand why Now() isn't working. Wondering if @anisjolly or @adebroise have encountered this before? Is it related to UTC time?

In the meantime, this calculation would minus 3 hours from a Time value:

LocalTime() - MakeTimeSpan(0, 3, 0, 0)

Hope this helps
Rob
 
Thanks for all your help Dawnson, im thinking too this is about some UTC time configuration inside BluePrism, will try your suggestion right now
 
Thanks for all your help Dawnson, im thinking too this is about some UTC time configuration inside BluePrism, will try your suggestion right now
Instead of that, you may try changing your local machine time to UTC. Blue Prism always works with UTC. For example if your client wants to run a queue at 9:00 am according to his time and you are working in some other country and the time zone is different then there could be an issue. So I'd suggest you to change your time zone to UTC.
 

tgundhus

Member
Hello,

@arodriguezm I can see you are located in Chile, which is UTC-3. The Now() variable returns time in UTC, this is per design. I suggest you use Now()+ LocalTime() - UTCTime() to get the full localtime in dateTime format. LocalTime() is based on your computers (Windows') Date&Time timezone settings. It may also be an option to manually set this.

If you wish more information regarding LocalTime(), Now(), or UTCTime(), please let me know.
 

kishoredeka

New Member
Hello,

You can use Utility- Date and Time Manipulation VBO. it has UTC to local action. It has "UTC time" and "Time Zone ID" as input parameter. Pass UTC time as now() and Time Zone ID as blank. It will give you local time with correct date.
 

tgundhus

Member
Hello,

You can use Utility- Date and Time Manipulation VBO. it has UTC to local action. It has "UTC time" and "Time Zone ID" as input parameter. Pass UTC time as now() and Time Zone ID as blank. It will give you local time with correct date.

The code behind the calc-stage e.g. Now(), UTCTime(), and LocalTime() is the same, I don't see any reason why you should add extra object-dependency if you don't use the timezone functionality or have the object used in any other process.
 

kishoredeka

New Member
The code behind the calc-stage e.g. Now(), UTCTime(), and LocalTime() is the same, I don't see any reason why you should add extra object-dependency if you don't use the timezone functionality or have the object used in any other process.

Absolutely correct . The code in calc-stage is exactly doing the same. I was just highlighting the presence of an existing VBO that can also perform the same action. In one of my project I was actually using Time Zone ID to get the time but got to know that it also provide the functionality of getting the local time. It definitely depends on the current requirement and the solution design whether to use an object or not.

But anyways your solution of getting local time is quite awesome. 1 line doing the trick..
 

kishoredeka

New Member
Hello,

@arodriguezm I can see you are located in Chile, which is UTC-3. The Now() variable returns time in UTC, this is per design. I suggest you use Now()+ LocalTime() - UTCTime() to get the full localtime in dateTime format. LocalTime() is based on your computers (Windows') Date&Time timezone settings. It may also be an option to manually set this.

If you wish more information regarding LocalTime(), Now(), or UTCTime(), please let me know.

I thought of using your solution in one of my object but was getting a wrong date. Seems like at boundaries (12:00 AM) it gives wrong date. Let me know if I am missing something. 1517806612595.png
 

Vimal25

Member
Dear Kishor ,

I am also thinking , why used three function used to get local time . Directly used Utility- Date and timespan and retrive localtime of current system.
Even system is localed at any place.

Please suggest in case I am assuming wrong .

Regards
Vimal
 

kishoredeka

New Member
Dear Kishor ,

I am also thinking , why used three function used to get local time . Directly used Utility- Date and timespan and retrive localtime of current system.
Even system is localed at any place.

Please suggest in case I am assuming wrong .

Regards
Vimal

Hi Vimal,

I always try to use this approach :
If a task can be performed without using any external utility/object than I try to follow that since it will not put additional burden on the process to load the object into memory. But if the logic itself is too complex then I use a thoroughly tested reusable object.
 

tgundhus

Member
Yes, thats true.. If you're "UTC - x" and run tasks on the evening this will lead to error.
You can switch it out with ToDateTime(Today() & " " & LocalTime())
 

madaric

New Member
Now() is 2 hours late compared to my local time. What I did was to use "MakeTimeSpan" functionality. Here's how I did it:

Now() + MakeTimeSpan(0,2,0,0)

Please take note that the values are in the order of Day, Hours, Time, Seconds. I hope this helps.
 

tgundhus

Member
Now() is 2 hours late compared to my local time. What I did was to use "MakeTimeSpan" functionality. Here's how I did it:

Now() + MakeTimeSpan(0,2,0,0)

Please take note that the values are in the order of Day, Hours, Time, Seconds. I hope this helps.

It's an issue with this, since now will return UTC and your localtime will probably move according to summer/winter time?
 

madaric

New Member
It's an issue with this, since now will return UTC and your localtime will probably move according to summer/winter time?

Well, I have not encountered this since on my location, we do not have shifting localtimes. You might want to consider a decision stage as a workaround before posting the datetime.
 
Top