Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
This question was closed Feb 15, 2018 at 08:06 PM by Bunny83 for the following reason:

The question is answered, right answer was accepted

avatar image
11
Question by Tom de Jank · Jan 07, 2010 at 10:43 PM ·

read Time and Date

Hi there, iam a freshman in using UNITY3D and i need for a project to read out the system time and date of the computer my game is running on. is there any way in java, c, or boo to do this?

lots of thanks ThisIsTom

Comment
Comments Locked · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image fzksbalint · Jan 17, 2017 at 09:13 AM 0
Share

Have any of you tried it in developement build? Because I just realized, that from the build I get the date and time of the creation, not the current. Anyone knows why it could happen? It's not the code, I'm shure, but had anyone ever had it, and know what caused it?

3 Replies

  • Sort: 
avatar image
21
Best Answer

Answer by duck · Jan 07, 2010 at 11:45 PM

Yes, you have access to most of the .net classes including the System.DateTime structure, and more specifically you can get the current date and time using the DateTime.now property.

Comment
Comments Locked · Show 4 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Tom de Jank · Jan 08, 2010 at 10:28 AM 0
Share

thanks for the answer, but if i try to read out the date in form "print(DateTime.now);" unity says - $$anonymous$$ identyfier DateTime -. what dit i wrong? thx ThisIs$$anonymous$$

avatar image duck ♦♦ · Jan 08, 2010 at 11:10 AM 5
Share

Ah yes, "DateTime" is part of .Net's System class which isn't included by default. You can fix this two ways: either change it to System.DateTime.now everywhere you use it, or add using System; at the top of your c# script (or in JS, add import System; at the top). Duck 1 $$anonymous$$ ago

avatar image Jesus_Freak · Dec 22, 2010 at 04:29 PM 0
Share

i just tried out that System.DateTime.now and unity said 'now' is not a mamber of Date; did you mean: 'Now' so the real version of the JS is var systemTime = System.DateTime.Now;

avatar image romanluks · Dec 26, 2014 at 06:27 PM 0
Share

Thank you, duck.

avatar image
16

Answer by Michael Neely · Oct 20, 2010 at 02:19 AM

This may help. Try using variables like these and see how it goes. You do have to

theTime = System.DateTime.Now.ToString("hh:mm:ss"); theDate = System.DateTime.Now.ToString("MM/dd/yyyy"); theMonth = System.DateTime.Now.get_Month(); theDay = System.DateTime.Now.get_Day();

Comment
Comments Locked · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image AmazingDeveloper2 · Oct 19, 2016 at 11:24 AM 0
Share

I try to do it, but I don't see saved data

 PlayerPrefs.SetString("date time" System.DateTime.Now.ToString("yyyy/$$anonymous$$$$anonymous$$/dd HH:mm:ss"));
 Debug.Log(PlayerPrefs.GetString("date time"));

Here what it show: UnityEngine.Debug:Log(Object)

avatar image msafa AmazingDeveloper2 · Feb 15, 2018 at 07:57 PM 0
Share

after set something use PlayerPrefs.Save(); for saving it.

avatar image
0

Answer by MinhajJaved · Feb 10, 2017 at 09:17 AM

@dmitry-kozyr try this PlayerPrefs.SetString("date_time", System.DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")); Debug.Log(PlayerPrefs.GetString("date_time"));

Comment
Comments Locked · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Epicci · Feb 10, 2017 at 02:06 PM 0
Share

You do know that this is 7 year old question?

avatar image BerdyGaming Epicci · Dec 26, 2017 at 09:50 AM 1
Share

Not only is it 7 y/o question, but the answer isn't correct.

Follow this Question

Answers Answers and Comments

8 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

How to import the object from server to unity 2 Answers

Setting Scroll View Width GUILayout 1 Answer

Can someone help me fix my Javascript for Flickering Light? 6 Answers

Material doesn't have a color property '_Color' 4 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges