News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Smf date format for database entry in java?

Started by Patey, August 31, 2014, 06:35:02 PM

Previous topic - Next topic

Patey

I'm trying to manually add a user to an smf database in java, but can't figure out how to get the current date in the proper format. anyone know how I can do that?

I'm attempting to do it with this code, but can't figure out the proper format:


    SimpleDateFormat sdformat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    Date now = new Date();
    String strDate = sdformat.format(now);

Arantor

You need a timestamp, which is the number of seconds since 1/1/1970. now.getTime()/1000 might get you somewhere useful.

Kindred

Smf dates, like most database dates are stored in unix time format...  Which, is as Arantor explains


Do note, there is more to adding a user than just adding a row in the members table.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Patey

Quote from: Kindred on August 31, 2014, 06:45:59 PM
Smf dates, like most database dates are stored in unix time format...  Which, is as Arantor explains


Do note, there is more to adding a user than just adding a row in the members table.

what else do I need to do?

Kindred

Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Arantor

Subs-Members.php, registerMember() in particular.

Patey

Quote from: Kindred on August 31, 2014, 07:11:03 PM
Look at the create user function...
Quote from: Arantor on August 31, 2014, 07:12:36 PM
Subs-Members.php, registerMember() in particular.

so maybe it'd be better if my question were "how to register member in java?" ? lol


I should be more specific with what I'm trying to do -

I'm designing a bukkit plugin for a minecraft server and I want the user to be able to register on the forums via command.

Arantor

Very few people here are Java programmers (I can read it but I'd be terrible at writing it)

Thing is, to register from Java that means you have to be running Java on your server...

Advertisement: