Current date and time

The 1C:Enterprise developers forum

#1
People who like this:0Yes/0No
Active user
Rating: 8
Joined: May 21, 2023
Company:

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

 
#2
People who like this:0Yes/0No
Administrator
Rating: 29
Joined: Oct 3, 2019
Company:

Hi Peter,

this can be done as follows:


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

 
#3
People who like this:0Yes/0No
Active user
Rating: 8
Joined: May 21, 2023
Company:

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

 
#4
People who like this:0Yes/0No
Administrator
Rating: 29
Joined: Oct 3, 2019
Company:

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.

 
#5
People who like this:0Yes/0No
Active user
Rating: 8
Joined: May 21, 2023
Company:

Get it. Thanks!

 
Subscribe
Users browsing this topic (guests: 2, registered: 0, hidden: 0)
Be the first to know tips & tricks on business application development!

A confirmation e-mail has been sent to the e-mail address you provided .

Click the link in the e-mail to confirm and activate the subscription.