VB6: time functions similar to the C language in seconds from January 1, January 1, 1970

Source: Internet
Author: User

 

The time in the program is usually-1-1 to the current time.

Function getsecondsfrom1970 () as long '% s seconds since' 00: 00: 00 1970-01-01 UTC "(a GNU extension) getsecondsfrom1970 = datediff (" S "," 1970/01/01 ", now () '2014/02 18:11:24 => 2011/03 end functionfunction getdatetimefromseconds (byval seconds as long) as string getdatetimefromseconds = format (dateadd ("S", seconds, "1970/01/01 "), "yyyy/mm/dd hh: mm: SS") '2017 => 1299089484 06:11:24 end Function

VB6 1970-01-01 second data time format

In the past, I was so stupid that I actually got the year, month, day, hour, minute, and second based on now, and then got a leap year judgment function, which was calculated from January 1, 1970 to the present .. It's really mentally retarded...

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.