Yes, We can! The function stime( ) sets the system date to the specified date. It also sets the system time. The time and date is measured in seconds from the 00:00:00 GMT, January 1, 1970. The following program shows how to use this function.#include <stdio.h>#include <time.h>void main( ){time_t tm ;int d ;tm = time ( NULL ) ;printf ( "The System Date : %s", ctime ( &tm ) ) ;printf ( "\nHow many days ahead you want to set the date : " ) ;scanf ( "%d", &d ) ;tm += ( 24L * d ) * 60L * 60L ;stime ( &tm ) ;printf ( "\nNow the new date is : %s", ctime ( &tm ) ) ;}In this program we have used function ctime( ) in addition to function stime( ). The ctime( ) function converts time value to a 26-character long string that contains date and time
C
Topic: C basics
Can we change the system date to some other date?
Browse random answers:
What is the output of printf(“%d”)?
What is the difference between const char *p, char const *p, and char* const p ?
What's the difference between a null pointer, a NULL macro, the ASCII NUL character and a null string?
Can we get the remainder of a floating point division ?
How to write a swap( ) function which swaps the values of the variables using bitwise operators.
Is there any difference between the two representations?
main(){ int c[ ]={2.8,3.4,4,6.7,5}; int j,*p=c,*q=c; for(j=0;j<5;j++) { printf(" %d ",*c); ++q; } for(j=0;j<5;j++){printf(" %d ",*p);++p; }}
Why doesn’t this code: a[i] = i++; work?
Write a pro gramme to show bubble sort on a set of 10 numbers?
How do I write code that executes certain function only at program termination?
Is NULL always defined as 0?
Find the output of followingmain(){float me = 1.1;double you = 1.1;if(me==you)printf("I love U");elseprintf("I hate U");}
What are storage memory, default value, scope and life of Automatic and Register storage class?
Nesting of loops in C may continue upto how many levels?
What are storage memory, default value, scope and life of Static and External storage class?
Write a function to swap any two numbers?
Which expression always return true? Which always return false?
Can we change the system date to some other date?
Give some explanation for "for" LOOP ON C LANGUAGE?
How to print 1 to 100 without using any conditional loop?
Can we get the process identification number of the current program?
C Program to print the following series:11 21 2 31 2 3 41 2 3 4 5
Write a pro gramme to show bubble sort on a set of 10 numbers?
How to set the system date through a C program ?
How can we find out prime numbers from 1 to 50?
Can we use scanf( ) function to scan a multiple words string through keyboard?
How to decide even and odd values without decision making loops?
Why the output of sizeof ( 'a' ) is 2 and not 1 ?
write c program fibbonaci series program?
Explain with an example the self-referential structure.
Describe structures and Union in brief.
How to extract the integer part and a fractional part of a floating point number?
How to build an expression trees ?
What's the difference between a null pointer, a NULL macro, the ASCII NUL character and a null string?
How do I get the time elapsed between two function calls ?
How do I write a program which can generate all possible combinations of numbers from 1 to one less than the given number ?
How can we read/write Structures from/to data files?
When should you use a type cast?
What are the advantages and disadvantages of external class?
Define recursion in C.
Differentiate Source Codes from Object Codes
How can you increase the size of a dynamically allocated array?
What is the difference between i++ and i+1 ?
How will you allocate memory to double a pointer?
What is the purpose of main( ) function ?
What is the simplest sorting method to use?
How to distinguish between a binary tree and a tree?
What is a stack ?
What are memory models?
How does C compiler store elements in a multi-dimensional array?
If the result of an _expression has to be stored to one of two variables, depending on a condition, can we use conditional operators as shown below?( ( i < 10 ) ? j : k ) = l * 2 + p ;
What are stdin, stdout, and stderr?
How do I use the function ldexp( ) in a program?
What value is yielded by a relational expression?
How do I print the contents of environment variables?
– Is the unary minus operator (-) the same as the subtraction operator (-)?
How do I convert a floating-point number to a string?
What can the %lu format specifier do?
What will be output when you will execute following c code?#include<stdio.h>void main(){ int check=2; switch(check){ case 1: printf("D.W.Steyn"); case 2: printf(" M.G.Johnson"); case 3: printf(" Mohammad Asif"); default: printf(" M.Muralidaran"); }}
Which of the following correctly shows the hierarchy of arithmetic operations in C?
What is automatic type promotion in c?
Which of the following is the correct usage of conditional operators used in C?
Declare a pointer which can point printf function in c.
Which of the following is the correct order if calling functions in the below code?
What are merits and demerits of array in c?
Which of the following are unary operators in C?
Is C a great language, or what? Where else could you write something like a+++++b ?
What will be output when you will execute following c code?#include<stdio.h>void main(){ int a=5,b=10,c=1; if(a&&b>c){ printf("cquestionbank"); } else{ break; }}a) cquestionbank b) It will print nothingc) Run time errord) Compilation errore) None of the above
How would you use the functions fseek(), freed(), fwrite() and ftell()?
What does static variable mean?
What is the simplest sorting method to use?
Difference between syntax vs logical error?
What will the preprocessor do for a program?
What is preincrement and post increment?
Way to minimize a last dimension regarding executable?
Write a program to interchange 2 variables without using the third one?
How much does static varied signify?
Way to minimize a last dimension regarding executable?
Difference between *p and **p?
Difference between pass by reference and pass by value?
What are enumerations?
Write a code for implementation of doubly linked list with use of single pointer in each node?
What is the use of typedef?
what are C tokens?
What are C identifiers?
What is preincrement and post increment?
What are bit fields? What is the use of bit fields in a Structure declaration?
Is it possible to have more than one main() function in a C program ?
Why n++ executes faster than n+1 ?
What will the preprocessor do for a program ?
What is a data type?
What will happen if any string in c is converted to integer explicitly?
Write a program to find the greatest of three numbers.
Write a program to check whether a given number is a prime.
Write a program to find the greatest among ten numbers.
Write a program to generate the fibonacci series
Write a program to display the multiplication table of a given number.
What is the difference between ‘break’ and ‘continue’ statements?
What is the difference between getchar and scanf functions for reading strings?
What is the difference between declaring a variable and defining a variable?