Desktop version

Main > Forum > 1C:Enterprise Platform > 1C:Enterprise – Business applications platform > Current date and time

Forum

Search UsersRules
Current date and time
#1
Active user
Points:: 0
Joined:: May 21, 2023

How to get current date and time with precision to at least minutes? CurrentDate(), CurrentSessionDate() and CurrentUniversalDate() don't work as expected.

Profile
#2
Administrator
Points:: 0
Joined:: Oct 3, 2019

Hi Peter,

this can be done as follows:


Code
curDate = CurrentDate();
   
Message("" + Year(curDate)+ "." + Month(curDate) + "." + Day(curDate) + "." + Hour(curDate) + "." + Minute(curDate));

Profile
#3
Active user
Points:: 0
Joined:: May 21, 2023

Looks like it's possible to save current date and time into string, but not into document attribute of date type.

Profile
#4
Administrator
Points:: 0
Joined:: Oct 3, 2019

In 1C, it is possible to store a Date type attribute in three types:

1. just a date, without time,
2. only time
3. date and time together.

Take a look at the screenshot.

But it is impossible to keep the time accurate to minutes without additional improvements.

Profile
#5
Active user
Points:: 0
Joined:: May 21, 2023

Get it. Thanks!

Profile
Subscribe
Users browsing this topic (guests: 1, registered: 0, hidden: 0)



© 1C LLC. All rights reserved
1C Company respects the privacy of our customers and visitors
to our Web-site.