<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: lihini223</title>
    <description>The latest articles on DEV Community by lihini223 (@lihini223).</description>
    <link>https://dev.to/lihini223</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F314014%2Fcb1595ad-f1a2-467b-8bdf-b3518f0b5d9c.png</url>
      <title>DEV Community: lihini223</title>
      <link>https://dev.to/lihini223</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/lihini223"/>
    <language>en</language>
    <item>
      <title>How to work with datetime module in python </title>
      <dc:creator>lihini223</dc:creator>
      <pubDate>Mon, 25 Jan 2021 00:13:23 +0000</pubDate>
      <link>https://dev.to/lihini223/how-to-work-with-datetime-module-in-python-947</link>
      <guid>https://dev.to/lihini223/how-to-work-with-datetime-module-in-python-947</guid>
      <description>&lt;p&gt;Since a date is not a data type in python on its own, we have to use the predefined python module called datetime to work with dates as date objects. Here I am going to explain the most important and frequently used classes from the module.&lt;/p&gt;

&lt;p&gt;First of all, we need to import the classes from the datatime module to use them. Here I have import date, time and datetime classes which we are going to talk about later.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from datetime import date
from datetime import time
from datetime import datetime
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These are the predefined functionalities in the python library that let us manipulate dates and times. We don’t have to write codes because the required code pieces are already written for us. We just have to import and use them in our code. Let’s get started to use some of the features.&lt;/p&gt;

&lt;h2&gt;
  
  
  DATE OBJECTS
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Get today’s date from the today ( ) method from the date class&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In this code we call the today ( ) method in the date class which returns the information about the current date.  The variable today holds the object that comes back from the date.today() function.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  today = date.today()
  print ("Today's date is ", today)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The output :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;today is  2021-01-23
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Print out the date’s individual components&lt;/strong&gt;&lt;br&gt;
The object that comes from the date.today function has several properties such as day, month, and year. I am going to print out the current day, month, and year in the below code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; print ("Date Components: ", today.day, today.month, today.year)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The Output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Date Components 23 1 2021
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Also, this has some other features which we can use to develop advanced features for an app. For example,  We can retrieve the weekday number as follows.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Retrieve today's weekday (0=Monday, 6=Sunday)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Today. weekday ( ) function will return a number which is according to the current weekday. Weekday numbers start with 0 for Monday as follows.&lt;/p&gt;

&lt;p&gt;[ 0: “Monday”, 1: “Tuesday”, 2: “Wednesday”, 3: “Thursday”, 4: “Friday”, &lt;br&gt;
5: “Saturday”, 6: “Sunday” ]&lt;/p&gt;

&lt;p&gt;We can use the weekday number as an index and print out the relevant day.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  print ("Today's Weekday #: ", today.weekday())

  days=["monday","tuesday","wednesday","thursday","friday",
  "saturday","sunday"]

  print ("Which is a " + days[today.weekday()])
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The Output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Today's weekday 5
Today's' saturday
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  DATETIME OBJECTS
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Get today’s date from the datetime class&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Instead of using date class, we can also use the datetime class as well. This class returns an object that contains the date along with the time. In the below code I have called the now ( ) function which returns the current date and time.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  today = datetime.now()
  print  ("The current date and time is ", today)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the output below we have got the date, hours, minutes, seconds, and milliseconds.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;today is 2021-01-23 01:44:35.870833
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Get the current time&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To get the time current time we need to get the time portion of the datetime object. In the below code t equals datetime.time. What I do here is I pass the results of datetime.now ( ) function to the datetime.time ( ) function. Then the datetime.time ( ) will get the time portion from the datetime.now ( ) result and assign it to t.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  t = datetime.time(datetime.now())
  print ("The current time is ", t)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the output, we have got jus the time&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;The current time is 01:44:35.870833
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To learn more about datetime module you can refer following links.&lt;br&gt;
&lt;a href="https://docs.python.org/3/library/datetime.html"&gt;https://docs.python.org/3/library/datetime.html&lt;/a&gt; &lt;br&gt;
&lt;a href="https://www.w3schools.com/python/python_datetime.asp"&gt;https://www.w3schools.com/python/python_datetime.asp&lt;/a&gt; &lt;br&gt;
&lt;a href="https://www.programiz.com/python-programming/datetime"&gt;https://www.programiz.com/python-programming/datetime&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Happy Coding !!! &lt;/p&gt;

</description>
      <category>python</category>
      <category>datetime</category>
      <category>modules</category>
      <category>classes</category>
    </item>
    <item>
      <title>HacktoberFest 2020</title>
      <dc:creator>lihini223</dc:creator>
      <pubDate>Sat, 17 Oct 2020 22:59:58 +0000</pubDate>
      <link>https://dev.to/lihini223/hacktoberfest-2020-4o0m</link>
      <guid>https://dev.to/lihini223/hacktoberfest-2020-4o0m</guid>
      <description>&lt;h2&gt;
  
  
  What I Learned From Hacktoberfest
&lt;/h2&gt;

&lt;p&gt;Hey folks!&lt;/p&gt;

&lt;p&gt;Here I'm going to share my experience with hacktoberfest 2020. Okay, I'll start from the beginning where I heard about hacktoberfest at first. My first impression of hacktoberfest happened at the ''Open Hack Day event 2019'' at NSBM Green University. That was the first time I participated in an open-source event. In that event  I got the opportunity and guidance on how to contribute to open-source, how to work with Git/GitHub. &lt;/p&gt;

&lt;p&gt;During the event, I was able to figure out how to participate to hacktoberfest. So the best part of the story is, that I couldn't make the pull requests on-site because I didn't take a laptop with me. That gave me a big motivation to go home and study about this Newly heard month-long open-source celebration. &lt;/p&gt;

&lt;p&gt;Somehow within a week, I learned git/GitHub which is really amazing, and made my 4 pull requests to participate in the hacktoberfest 2019. After that, I was so curious about this opensource thing. So I decided to continue. And I was waiting for the Hacktoberfest2020 event. &lt;/p&gt;

&lt;p&gt;oh! It's here.. for today, I've completed the hacktoberfest2020 challenge and claimed the swag also. It was so nice to collaborate with new projects and other developers all around the world. This time I was focus on web-based projects written using mostly javascript. And I contributed some other C# projects as well.&lt;/p&gt;

&lt;p&gt;So Freshers, If you are looking for an opportunity to bump into open-source, Hacktoberfest is the ideal place to start off with. Trust me this Hacktoberfest thing changed my life. It was a huge turning point in my life as a fresh undergraduate at that time.&lt;/p&gt;

&lt;p&gt;So guys contribute and make an impact to make the techno world a better one. I'll put links to some tutorials that I took when I bumped into open-source below.&lt;/p&gt;

&lt;p&gt;Github learning lab: &lt;a href="https://lab.github.com/"&gt;https://lab.github.com/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Git/Github Tutorial by NetNinja youtube channel :&lt;br&gt;
&lt;a href="https://youtu.be/3RjQznt-8kE"&gt;https://youtu.be/3RjQznt-8kE&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Github Documentation: &lt;a href="https://docs.github.com/en"&gt;https://docs.github.com/en&lt;/a&gt;&lt;/p&gt;

&lt;h5&gt;
  
  
  OpenSource | GitHub | Git | HacktoberFest | hacktoberfest2020
&lt;/h5&gt;

</description>
      <category>hacktoberfest</category>
    </item>
    <item>
      <title>How to learn coding?</title>
      <dc:creator>lihini223</dc:creator>
      <pubDate>Wed, 02 Sep 2020 19:49:38 +0000</pubDate>
      <link>https://dev.to/lihini223/how-to-learn-coding-5hf0</link>
      <guid>https://dev.to/lihini223/how-to-learn-coding-5hf0</guid>
      <description>&lt;p&gt;This is the question when you just bump into computer science. Most of the time beginners are struggling with mainly three problems. When to learn, what to learn and how to learn. These questions are raised because the tech industry is rapidly changing. For example, now we have fields like data science, AI, AR, VR, and many more. &lt;/p&gt;

&lt;p&gt;What I have learned from my experiences is “don’t go after new technologies without mastering basics”. If you are a beginner, start from scratch, master the basics, then choose a new technology and go in-depth to do cool stuff.&lt;/p&gt;

&lt;p&gt;If you have mastered the basics, learning new technologies is nothing for you. I’ll share some tips that I have followed.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Talk with your seniors/lecturers. &lt;br&gt;
ask questions, and carefully listen to what they have to say. They will guide you with their experiences. That is a very important thing when it comes to IT industry.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Start with the basics. &lt;br&gt;
I recommend you to learn HTML/CSS at the beginning. Then learn programming with C language. If you master the basics of C language, trust me learning another language is super easy. After you finish with C basics, move back to HTML/CSS with javascript and PHP. Then you will get the basic idea of how to create a website, write an algorithm, and working with databases. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Follow a tutorial series that is best for you.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Learn one thing at a time&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Practice it&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Do a project&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The most important thing I have to mention is “Google and search for everything that comes to your mind”. That is the best advice that I can give you when it comes to programming. In my case, I googled every problem that comes to my mind. And that leads me to explore new areas as well as finding the solution.&lt;/p&gt;

&lt;p&gt;When it comes to tutorials, You can refer loads of websites and youtube tutorials to learn anything within seconds. And there are so many online learning platforms also. You can take courses on what you wish to learn and master the skill.&lt;/p&gt;

&lt;p&gt;In the upcoming articles, I will mention the best online learning platforms, youtube channels, and learning resources that would help you to learn code.&lt;/p&gt;

&lt;p&gt;Happy Coding!&lt;/p&gt;

</description>
      <category>computerscience</category>
      <category>productivity</category>
    </item>
  </channel>
</rss>
