I am using GCC on FEDORA.
I want to print current date an time. How can do that.
Thanks
-Sanchit 6 4367
On 14 Apr 2008 at 17:14, Sanchit wrote:
I am using GCC on FEDORA.
I want to print current date an time. How can do that.
system("date");
On Apr 14, 10:21 pm, Antoninus Twink <nos...@nospam.invalidwrote:
On 14 Apr 2008 at 17:14, Sanchit wrote:
I am using GCC on FEDORA.
I want to print current date an time. How can do that.
system("date");
Oh I forgot to mention.. I want a C function for this.
On 14 Apr 2008 at 17:39, Sanchit wrote:
On Apr 14, 10:21 pm, Antoninus Twink <nos...@nospam.invalidwrote:
>On 14 Apr 2008 at 17:14, Sanchit wrote:
I am using GCC on FEDORA.
I want to print current date an time. How can do that.
system("date");
Oh I forgot to mention.. I want a C function for this.
strftime?
On 14 Apr, 19:14, Sanchit <sanchitgupt...@gmail.comwrote:
I am using GCC on FEDORA.
I want to print current date an time. How can do that.
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
int main(){
time_t now = time(NULL);
struct tm *now_s = localtime(&now);
if(now_s == NULL)
return EXIT_FAILURE;
printf("%d-%02d-%02d %02d:%02d:%02d\n", 1900+now_s->tm_year, ++now_s -
>tm_mon,
now_s->tm_mday, now_s->tm_hour, now_s->tm_min,now_s->tm_sec);
return EXIT_SUCCESS;
}
Bye.
>I am using GCC on FEDORA.
> I want to print current date an time. How can do that.
In C, time() gets you the current date/time in a time_t format.
Various functions can get that into a printable string format:
ctime()
localtime() followed by strftime()
localtime() followed by asctime()
On Apr 14, 10:39 pm, Sanchit <sanchitgupt...@gmail.comwrote:
On Apr 14, 10:21 pm, Antoninus Twink <nos...@nospam.invalidwrote:
On 14 Apr 2008 at 17:14, Sanchit wrote:
I am using GCC on FEDORA.
I want to print current date an time. How can do that.
system("date");
Oh I forgot to mention.. I want a C function for this.
http://www.cs.utah.edu/dept/old/texi...19.html#SEC320 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Gord |
last post by:
Many scripts and calendars call client side system time in order to
make presentations.
However, the client's time may be improperly set, if set at all,
and/or the relevant time may be from...
|
by: John Feeley |
last post by:
am tring to add a number of years to a dob. im doing this by adding my
date+years*365.26 I get a string of numbers. I then convert the number in
the next column to actual date again. I'm getting...
|
by: Manny Chohan |
last post by:
Guys,
I have intranet application which our users use in offices all over the
world. How can i retrieve the date and time on their pc and display it on the
screen no matter what country they are...
|
by: Thomas Homan |
last post by:
Hello,
Is there a method in the FtpWebRequest that allows for preservation of the
file being transferred original date and time in vs2005 vb?
In the FTPSample the method is to set up stream...
|
by: x |
last post by:
hi
i am a pilot by profession. i want to create a database of my logbook
using ms access 2002. i am facing a problem regarding the format of
time field. when i select "Data/Time" data type for my...
|
by: rdemyan via AccessMonster.com |
last post by:
Is there a way to get the internet date/time. I saw an article that uses
WinSock, but WinSock doesn't seem to be available in Access.
I want to verify that the date/time on the local PC running...
|
by: wanwan |
last post by:
Hi,
I'm looking for a better way to do a date/time elapsed event rather
than a timer elapsed event.
Currently, I wrote my program to use a timer elapsed event set to 1
second, and it checks...
|
by: Nathan Sokalski |
last post by:
When determining whether a String can be converted to a DateTime, you can
use the IsDate() method. However, I would also like to know whether the
string is a date, a time, or both a date and a...
|
by: Matt.Russett |
last post by:
Hello,
Here is what I am trying to do.
I am running a report that brings back Requested Pick-Up Times and
Actual Pick-Up Times. What I want to measure is the amount of times
the Requested...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |