Time.h library

Hi all

I'm trying to set up the time using the Time library. I want to use the setTime function but don't know how.

Any help?

Have you looked at any of the many examples that come with that library?

The easiest way is to just call setTime with a unix time stamp.

There is also a version that takes 6 arguments. I think it is pretty self explanatory what each one represents.

void setTime(int hr,int min,int sec,int dy, int mnth, int yr){

Could be called to set the time to right this second that I am writing this as:

setTime(22, 46, 00, 16, 11, 2015);  // 10:46PM November 16th 2015

To do the same with a unix time it might be

setTime(1447735664);  // unix time as I was writing this

What part is confusing you? Or did you ask this question before reading anything about it?

I'm just starting mate, I didn't realise I had to call it with void... but thanks heaps for the help!

No, it is defined with void. You call it like you call any other function. The word "void" should not appear when you call it. When I wrote examples of calling the function did I write "void" anywhere? Nope, it only appears in the one box where I showed you the definition.

Google "C++ tutorial". There is a wealth of information to help you get started with the basics.