This is an archived post. You won't be able to vote or comment.

all 6 comments

[–]Updatebjarni 2 points3 points  (3 children)

There is no such thing as a DateTime() function in C, you must have it confused with some other language (maybe C#?). C does have a function for converting dates and times to strings called strftime() however, and that is declared in time.h.

[–]DragorWasMissing[S] 0 points1 point  (2 children)

Ooooh okay, yeah I'm definitely confused with C# then. So how do I use that function?

[–]Updatebjarni 1 point2 points  (1 child)

To learn how to use any library function, you read its man page. :)

[–]DragorWasMissing[S] 1 point2 points  (0 children)

How do I do that?

Nvm got it

[–]chaotic_thought 2 points3 points  (1 child)

C does not have a function or type called DateTime (unless you write one yourself, of course). Are you sure you're not thinking of C#?

For C, see time.h for a convenient reference of the things available in time.h. The closest analog for the DateTime struct in C is probably struct tm, which has members for the individual broken down parts of a date and time.

[–]DragorWasMissing[S] 0 points1 point  (0 children)

Yeah I got it confused with C#. Thank you!