A billing program was made some time ago, which involves the calculation of the date and time. For example, when the time before (or after) a certain time of day is met, the UNIX C system itself does not provide such a function. The author has explored a function that asks for time and is now introduced to everyone.
Function introduction and parameter description;
The main function of this function is to find the date and time of the previous or the last (bill_long is negative) and its week according to the given date and time. ;
The parameters are as follows:;
s: for a given date and time, such as June 20, 2001, 18:30:04 is "20010602183004";
bill_long: the given length of time in seconds;
d_str: the date obtained, such as June 2, 2001, "20010602";
t_str: the time of the determination For example, 18:28:06 is "182806";
The function returns the value of the week, such as Sunday, 0, Monday to Saturday, respectively, 1 to 6.
Implementation Code
The concrete implementation code of this function is as follows:
int GetDateTime( char s,long int bill_long,chard_str, char t_str) {
time_t timer,tim ;
struct tm tb, tb1 ;
int year_off = 1900 ;
int mon_off = 1 ;
char s1[ ,null,null,3],20] ;
if ( strlen( s )!=14 )
return -1;
strncpy( s1, s, 4 );
S1[4] = '
How to adjust the screen orientation of Windows 7 1, right click on the blank space on the deskto
How to change the computer name The computer name is the name of the computer, which is different fr
How to add clocks in different time zones for Windows 7 1. Left click on the time mark at the bot
How to delete an account in Windows 7 1. Open the Start Menu and select Control Panel. 2. Select
Clear the registry of all IE plugins
Web page acceleration processing - page weight loss and reduction experience skills
How to change the computer name
Install a virtual network card to achieve virtual machine and local access
Windows 7 view the disk space occupied by the restore point and set the maximum space
Windows practical tips: Solution after the shutdown button is disabled
Alternative tips Easily search for computers on the LAN
Windows 7 management and disabling IE8 add-ons
Network integrated machine installation driver notes
How to extend the life time of Windows 8 notebook
Win8.1 local account switch Microsoft account 0xd00000bb solution
What should I do if the Win7 dual monitor maximizes the window display?
Anti-virus software causes users to log in to Windows 8?
How to view the connected wifi password in win8?
Used to boot the partitions of the Win8 system GPT partition structure disk
How does the Win8 system view the installation patch history?
Win7 running software prompt 360se.exe damaged image solution
What kind of hardware standard can be used to install Win8.1 system