473,396 Members | 2,037 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.

String date to time_t

High all,

I want to calculate the difference between two date with DiffTime function which use time_t structure of the two date. But the two date are in string format. So, how can I do to convert date string in tim_t ?

Thank you in advance.
Jun 11 '07 #1
2 3369
weaknessforcats
9,208 Expert Mod 8TB
You will need to convert your date string into seconds and put the result in a time_t.
Jun 11 '07 #2
Silent1Mezzo
208 100+
High all,

I want to calculate the difference between two date with DiffTime function which use time_t structure of the two date. But the two date are in string format. So, how can I do to convert date string in tim_t ?

Thank you in advance.
1. parse your string into a struct tm
2. Call mktime() store it into your time_t var
Jun 11 '07 #3

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

Similar topics

2
by: Erik Johnson | last post by:
the following script... <?php $times = array( '2004-04-04 00:31:00-06', '2004-04-04 01:00:00-06', '2004-04-04 01:59:59-06', '2004-04-04 02:00:00-06', '2004-04-04 03:00:00-06',
12
by: Michael B Allen | last post by:
Are there any localized facilites for performing date arithmetic that properly considers leap years, daylight savings time, and whatever other peculiarities of the gregorian lunar calendar? ...
3
by: Matt | last post by:
Given a date, how to find the beginning date and ending date of that week please advise!
3
by: Ilja Booij | last post by:
Hi all, I have some trouble with the following: I'm getting a time string, in YYYY-MM-DD HH:mm:ss format, which I need to translate into a string with DD-Mon-YYYY HH:mm:ss +HHMM, where the...
11
by: Laery | last post by:
Hi, I'm currently adding a new module to an old borland C3.1 application (dos). And I need to calculate a date by subtracting the number of days from a given date. I know I could use an...
5
by: David Requena | last post by:
Hi All, I'm trying to parse a file which has some timestamps embedded. These're expressed as a number of seconds elapsed since 01/01/1904 (macintosh time). I know OS X provides some APIs to...
6
by: leorulez | last post by:
I was wondering if there is any way in C to read the date and time (either system time or from the keyboard) and see if it falls between certain date and time? I am not sure how to compare the 2...
3
by: pbrama | last post by:
I have a customer that supplied me with a text file that has some data and dates stored, apparently, as milliseconds since 01/01/1970 12:00a. I need to display the date/time in their application. ...
7
by: Nick Keighley | last post by:
Hi, this is probably quite easy... How do I convert a UTC string into a time_t? eg. "2007-12-18 13:37:26" - a time_t. Now FAQ 13.3 says use mktime() to convert a struct tm into a time_t...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
Oralloy
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,...
0
jinu1996
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.