Page 4 of 4 FirstFirst ... 234
Results 31 to 34 of 34

Thread: Server time

  1. #31
    Senior Member
    Join Date
    Oct 2015
    Location
    Germany
    Posts
    292
    @HATANO_KENJI

    DateTime.Now is what you need.
    this sample returns the current server time:
    Code:
    plugin.SendGlobalMessage("Current Server Time: " + DateTime.Now.ToString("yyyy/MM/dd HH:mm"));
    you can format the DateTime string like this:
    DateTime.Now.ToString("MM/dd/yyyy"); // 07/21/2007
    DateTime.Now.ToString("dddd, dd MMMM yyyy"); //Saturday, 21 July 2007
    DateTime.Now.ToString("dddd, dd MMMM yyyy HH:mm"); // Saturday, 21 July 2007 14:58
    DateTime.Now.ToString("dddd, dd MMMM yyyy hh:mm tt"); // Saturday, 21 July 2007 03:00 PM
    DateTime.Now.ToString("dddd, dd MMMM yyyy H:mm"); // Saturday, 21 July 2007 5:01
    DateTime.Now.ToString("dddd, dd MMMM yyyy h:mm tt"); // Saturday, 21 July 2007 3:03 PM
    DateTime.Now.ToString("dddd, dd MMMM yyyy HH:mm:ss"); // Saturday, 21 July 2007 15:04:10
    DateTime.Now.ToString("MM/dd/yyyy HH:mm"); // 07/21/2007 15:05
    DateTime.Now.ToString("MM/dd/yyyy hh:mm tt"); // 07/21/2007 03:06 PM
    DateTime.Now.ToString("MM/dd/yyyy H:mm"); // 07/21/2007 15:07
    DateTime.Now.ToString("MM/dd/yyyy h:mm tt"); // 07/21/2007 3:07 PM
    DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss"); // 07/21/2007 15:09:29
    DateTime.Now.ToString("MMMM dd"); // July 21
    DateTime.Now.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK"); // 2007-07-21T15:11:19.1250000+05:30
    DateTime.Now.ToString("ddd, dd MMM yyyy HH':'mm':'ss 'GMT'"); // Sat, 21 Jul 2007 15:12:16 GMT
    DateTime.Now.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss"); // 2007-07-21T15:12:57
    DateTime.Now.ToString("HH:mm"); // 15:14
    DateTime.Now.ToString("hh:mm tt"); // 03:14 PM
    DateTime.Now.ToString("H:mm"); // 5:15
    DateTime.Now.ToString("h:mm tt"); // 3:16 PM
    DateTime.Now.ToString("HH:mm:ss"); // 15:16:29
    DateTime.Now.ToString("yyyy'-'MM'-'dd HH':'mm':'ss'Z'"); // 2007-07-21 15:17:20Z
    DateTime.Now.ToString("dddd, dd MMMM yyyy HH:mm:ss"); // Saturday, 21 July 2007 15:17:58
    DateTime.Now.ToString("yyyy MMMM"); // 2007 July
    Developer of the VIP Slot Manager Plugin

  2. #32
    plugin.SendGlobalMessage("Current Server Time: " + DateTime.Now.ToString("yyyy/MM/dd tt HH:mm")); // 2018/06/30 AM:00:00

    Thank you for your help!

    I have been able to correctly display the time format I want, But the game server seems to be different from my time zone.

    Excuse me, Can we show the current time of the player?

    PS.Our time zone is: GMT+8
    Last edited by HATANO_KENJI; 29-06-2018 at 22:07.

  3. #33
    Senior Member
    Join Date
    Oct 2015
    Location
    Germany
    Posts
    292
    Quote Originally Posted by HATANO_KENJI View Post
    ...
    PS.Our time zone is: GMT+8
    Code:
    plugin.SendGlobalMessage("Current Server Time (China): " + DateTime.UtcNow.AddHours(8).ToString("yyyy/MM/dd HH:mm"));
    Developer of the VIP Slot Manager Plugin

  4. #34
    Thank you for your help!

    Problem has been solved!

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •