how to get the current date and time of the system in java -


मुझे सिस्टम की वर्तमान दिनांक और समय प्राप्त करने की आवश्यकता है I जावा में और एक शर्त डाल दी है कि अगर इसकी 12 PM तो कुछ लोगों को मेल भेजें।

असल में एक टाइमर । तो मैं इसे कैसे प्राप्त कर सकता हूं? मैं क्वार्टज टाइमर या crontab अभिव्यक्ति का उपयोग नहीं करना चाहता, लेकिन इसे केवल जावा में करना है।

कृपया एक उदाहरण की सहायता से समझाएं।

आप समय के साथ तिथि प्राप्त कर सकते हैं

  आयात करें java.text.SimpleDateFormat; Import java.util.Calendar;  

और कोड

  कैलेंडर चालूडेटा = कैलेंडर.जस्ट इन्स्टेंस (); SimpleDateFormat formatter = नया सरलडेटफ़ॉर्मेट ("डीडी-एमएम-वाई वाई वाई वाई-एचएच: मिमी: एसएस"); स्ट्रिंग दिनांकनौ = formatter.format (currentDate.getTime ()); Println (dateNow);  

Comments

Popular posts from this blog

mysql - How to enter php data into a html multiple select box -

java - Can't add JTree to JPanel of a JInternalFrame -

java - How to drag a JavaFX node and detect a drop event outside the JavaFX Windows? -