473,396 Members | 1,997 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

C++ program on dates

hela'zZz;

kindly tell me what to do in making c++ program on dates please...... kinda novice programmer in here.....
Jul 4 '07 #1
1 1028
archonmagnus
113 100+
What exactly are you wanting to do concerning the usage of the date? If you just want to output the date, you can use the "time" and "ctime" functions (oddly enough from the "ctime" library file) as evidenced in the following code:

Expand|Select|Wrap|Line Numbers
  1. #include <iostream>
  2. #include <string>
  3. #include <ctime>
  4.  
  5. using namespace std;
  6.  
  7. int main (int argc, char *argv[])
  8. {
  9.     string time_string;
  10.  
  11.     time_t timeInfo;
  12.     timeInfo = time(NULL);
  13.     time_string = ctime(&timeInfo);
  14.  
  15.     cout<<"The current time is: "<<time_string<<endl;
  16.  
  17.     return 0;
  18. }
  19.  
Note that the value returned from "ctime" contains a newline character and is null terminated.
Jul 4 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: Colin Steadman | last post by:
I'm a stupid ASP programmer and I dont do Javascript (except for very simple tasks anyway), and I'm in a bit of a predicament. I've used a javascript table sorting script from here: ...
1
by: Prafull Soni | last post by:
hi Can anyone give me program to find difference between two dates? thanks Prafull Soni
12
by: Dixie | last post by:
I am trying to calculate the number of workdays between two dates with regards to holidays as well. I have used Arvin Meyer's code on the Access Web, but as I am in Australia and my date format is...
8
by: Hardy &&& | last post by:
I have a friend, his name is "REWISH". Rewish receives his payment from the bank every 14 days. Last payment he received was 12/ 07/ 2006. He visited me 2days ago.He was very upset,because many...
0
by: georges the man | last post by:
The purpose: • Sorting and Searching • Numerical Analysis Design Specification You are to write a program called “StockAnalyser”. Your program will read a text file that contains historical...
4
by: georges the man | last post by:
hey guys, i ve been posting for the last week trying to understand some stuff about c and reading but unfortunaly i couldnt do this. i have to write the following code. this will be the last...
1
by: cyberchic27 | last post by:
I'm trying to teach myself how to write programs and I've written quite a few. My lastet one entails that I: Write a program that determines the number of days between two dates. Must have one...
9
by: MonkeyHater | last post by:
Hey, I am trying to write a program that allows someone to enter two separate dates and returns the later of the two. I.E. I input 2/14/2004 and 3/2/2004, so it outputs 3/2/2004. This is what I have...
2
by: daffy2 | last post by:
Simple as it might seem this has defeated me so far. I want to enter sequential dates for say 1 year in a table by means of a stored program. I can attach one of my many effoorts if it helps. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
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,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.