WordPress Error Establishing a Database Connection

Category Image 032

WordPress Error Establishing a Database ConnectionWordPress is a powerful content management system (CMS) by all means, but it comes with its fair share of debilitating errors. Just like any other human-made system, it’s prone to errors that can result from many different things. Perhaps you installed a faulty theme or plugin and messed up your install. Maybe a natural disaster […]

The post WordPress Error Establishing a Database Connection appeared first on WPExplorer.

How to Get a SSL Certificate

Featured Imgs 23

Security needs to be a top priority for every website. From small personal blogs to global ecommerce sites, added security builds trust with visitors and boosts search rankings.

If you’re looking for a quick and easy way to secure your website, start with an SSL certificate.

What is an SSL certificate? SSL stands for “secure sockets layer.” It’s an internet protocol that secures the data transfer between a website and the visitor’s web browser. SSLs are typically used to protect login credentials, credit card data, and other sensitive information.

Generally speaking, SSL certificates can cost anywhere from $50 to $200 per year. But there’s no reason to pay those prices.

As someone who has owned and managed dozens of sites throughout my career, I’ll show you how to get an SSL for free.

What to Expect When Getting a Free SSL Certificate

The best way to get a free SSL certificate is by signing up for a web hosting plan from Bluehost. All of their hosting packages come with a free SSL, and the entire process can be completed in just three simple steps:

  1. Visit Bluehost.com
  2. Sign up and choose a hosting plan
  3. Activate the SSL

The Good

For the most part, getting an SSL certificate is easy. Many web hosting providers include a free SSL certificate with hosting plans. You need to get web hosting regardless, so it makes sense to get a hosting plan and SSL all from the same provider.

In many cases, you won’t even need to select the SSL certificate as an add-on. The certificate will automatically be bundled within the hosting plan.

You can get an SSL certificate for free with entry-level web hosting. Most new websites choose shared web hosting. These plans are cheap and have enough resources to accommodate brand new sites. Even with these low-cost hosting packages, you can still get an SSL certificate for free.

There is no shortage of reputable web hosting providers on the market today. So, you won’t have to dig too hard to find one that will provide you with a free SSL. I’ll show you my favorite option shortly (Bluehost).

The Bad

Getting an SSL certificate for free involves a few extra steps. It’s not a one-click process.

New website owners need to buy a domain and find a web hosting provider before they can consider getting an SSL certificate. Choosing a CMS (content management system) or site builder is something else that you’ll have to ponder. Some of these extra steps will cost money. And web hosting isn’t free, so you’ll still have to pay something.

But just because you have an SSL certificate doesn’t necessarily mean that it’s activated. So, there might be an additional step or two for enabling your SSL. Once installed, it could still take a few hours to activate.

Starting a website without an SSL certificate is a bad idea. Besides exposing your visitors to potential threats and hackers, some web browsers go out of the way to inform people that the site isn’t secure.

If people see this next to your URL, it makes them nervous and causes them to leave your site.

Personally, I always try to avoid unsecured websites. I’m not alone in this thought process. In fact, 50.8% of people immediately leave a website when they see a “not secure” notice. An additional 23.8% of visitors say they won’t share any personal details on these sites.

Step 1 – Visit Bluehost.com

Bluehost is arguably the most reputable and reliable web hosting provider on the market today. It’s an easy and affordable way for new websites to get a hosting plan and SSL certificate.

I like Bluehost because it’s essentially an all-in-one solution for new website needs. All hosting packages come with a free SSL certificate and a free domain.

They have hosting solutions for everyone. Whether you’re looking for a cheap entry-level plan, managed solution, WordPress hosting, or web hosting for an ecommerce site, Bluehost has you covered.

Before we dive into the free SSL, take a minute to assess your hosting needs. This will make the process much smoother as you continue through the tutorial. Here’s a brief overview of Bluehost’s hosting solutions, which will help you determine the best option for your website.

Shared Hosting

For new websites, shared hosting will be the best option. These plans are cheap but still accommodate the needs of low-traffic sites.

You’ll be sharing server resources with other websites, which can potentially cause slower loading times and performance issues. But that’s fine for most new sites, especially for smaller sites and personal blogs.

If you’re not expecting a ton of website visitors for the foreseeable future, there’s really no reason to break the bank and choose anything more advanced than a shared hosting plan.

In addition to a free SSL certificate, all of Bluehost’s shared plans also come with a free CDN and free domain for one year.

VPS Hosting

Bluehost’s VPS (virtual private server) plans are designed for sites that want better performance. This is a step above shared hosting and comes at a higher price point as well.

VPS hosting provides guaranteed resources to your site. While you’ll technically still be sharing a server with other websites, you’ll have dedicated resources on your “virtual” server.

For sites expecting higher volumes of traffic out of the gate, VPS hosting is a viable option. Advanced users will benefit from features like optional root access as well.

Dedicated Hosting

Dedicated hosting is the top of the line in web hosting. You can rent an entire server just for your website and won’t have to share it with anyone else.

These packages come with premium performance, but for a premium price.

The vast majority of you won’t need a dedicated hosting plan, so I won’t spend too much time explaining how this works. But generally speaking, these are reserved for high-traffic sites or for people who want complete control over their hosting environment.

WordPress Hosting

Bluehost has hosting plans that come with an automatic WordPress installation. This is one of only three web hosting providers explicitly recommended by WordPress, so these plans are extremely popular.

They also offer fully managed WordPress hosting, a viable option for growing websites with higher traffic volumes. Even the entry-level managed hosting plan can accommodate up to 50,000 visitors per month.

Additionally, Bluehost has ecommerce plans optimized for WooCommerce. So, if you’re planning to run an online store via WordPress with the WooCommerce plugin, these plans will be perfect for you.

Step 2 – Sign Up and Choose a Hosting Plan

Now that you understand the different hosting options offered by Bluehost, it’s time to select a plan that’s right for you. For the purposes of this tutorial, I’ll go with a shared hosting plan since most of you will likely fall into that same boat.

Here’s a quick overview of the shared packages:

All of these plans come with a free SSL certificate. Once you’ve decided on a package, just click “Select” to continue.

Set Up Your Domain

After selecting a plan, you’ll automatically be prompted to set up your domain. There are two options to choose from, depending on your unique situation: creating a new domain or using a domain you already own.

This is pretty self-explanatory. If you’ve already purchased a domain elsewhere, just enter it here. For those of you who don’t have a domain name yet, you can search for an available domain and get one directly from Bluehost.

Another reason why Bluehost is so appealing for new websites is that you’ll get a domain free for the first year when you create it with Bluehost.

If you’re not ready to do this quite yet, you can skip it and set up your domain later. Even if you skip this step, you’ll still be entitled to a free domain credit if you get one with Bluehost.

Since this tutorial focuses on getting an SSL certificate, I’ll select the option at the bottom of the screen and create my domain later.

Create Your Account

Bluehost will prompt you to sign up and create an account. You’ll just need to provide some basic details about yourself or your business to continue.

Those details include:

  • First and last name
  • Business name (optional)
  • Address
  • Phone number
  • Email address

This is about as straightforward as it gets and shouldn’t take more than a minute or so to fill out.

Choose Your Plan Terms

To get the best possible rate, sign up for a 36-month plan, and pay upfront. Bluehost also offers 24-month plans and 12-month hosting plans.

I’m all about value, so I recommend choosing the most extended contract to get the best terms. But the plans are cheap no matter what term length you decide on. Don’t overthink it.

As you can see, a free Let’s Encrypt SSL is automatically added to your package. You don’t need to check any boxes or select an add-on to get this feature.

Bluehost will hit you with a couple of other upsells as you finalize the package. Examples include SEO tools and SiteLock Security. You can probably skip the SEO tools, but lots of people like SiteLock for added security. This covers things like malware detection, weekly scan reports, automatic malware removal, file-level scanning, and Google blacklist monitoring. You’ll want these features eventually, so it makes sense to get it now.

Provide Payment Details

Paying for your Bluehost plan is the final step to creating an account. Just enter your credit card details or pay via PayPal.

A 30-day money-back guarantee backs Bluehost plans. So, if you decide to cancel within 30 days, you’ll be eligible for a full refund. This guarantee doesn’t extend to add-on products like purchased domain names.

Your plan will automatically renew at the regular rate when the term expires. That’s another reason why I recommend locking in a longer contract. You won’t be able to access these low introductory rates after the first term.

Step 3 – Activate the SSL

Once you’re signed up, you need to make sure the SSL is active. In most cases, the SSL will be automatically assigned to your website and install itself on the domains in your account. However, some Bluehost customers need to enable the SSL certificate manually.

Whether you got your domain from Bluehost or a third-party provider, always verify that the SSL has been activated.

This is easily managed from your Bluehost control panel.

Click the “My Sites” Menu From Your Bluehost Dashboard

Once you’ve logged in to Bluehost, make your way over to the “My Sites” page of the dashboard. For those of you who have multiple sites hosted in the same account, you’ll see all options listed here.

Find the site you want to activate the SSL for and click the “Manage Site” button.

Enable Free SSL Certificate From the “Security” Tab

From here, you need to make your way to the “Security” menu. This can be found towards the top of the screen.

Next, locate the “Security Certificate” portion of this page. You’ll see “Free SSL Certificate” listed in this area.

If the certificate is turned on (as shown above), there’s nothing you need to do. The SSL has already been installed. If not, simply toggle the free SSL certificate to the “on” position to activate it.

Once turned on, the SSL certificate can take a few hours to install itself completely and activate. Don’t be alarmed if your site is still showing as “not secure” immediately after turning the SSL on.

Keep a close eye on your email for the next few hours as well. In some instances, Bluehost will require you to complete an action to continue. Clear instructions will be sent to you via email if necessary.

If for some reason you ever want to de-activate the SSL, follow the same steps, and just switch the slider to the “Off” position.

Email Design Trends for 2021

Category Image 051

This post is originally published on Designmodo: Email Design Trends for 2021

Email Design Trends for 2021

Even though the world looked different in 2020, subscribers’ tastes and preferences continued to shape and change elements of successful email design. Email design trends for 2021 suggest that people will be delighted to see newsletters with long text to …

For more information please contact Designmodo

WordPress 5.6 Is Here, State of the Word, “Learn WordPress” Launches 🗞️ January 2021 WordPress News w/ CodeinWP

Category Image 091
Hey everyone, we wish you all a Happy New Year and hope you have a great year ahead. Let’s have a look at how the last month of the year was for WordPress and what to expect heading into the new year. There’s certainly been a lot going on in the WordPress ecosystem. For once, we have a completely new version of WordPress, and Matt Mullenweg held his annual State of the Word. But there’s more!

How to Highlight Text in WordPress (Beginner’s Guide)

Category Image 052

Are you looking for a way to highlight text in a WordPress post or page?

Highlighting text can help point the user’s attention to a specific part of your content. This can be great to show off a call to action, a special offer, or to simply add emphasis on specific sentences.

In this article, we will show you how to easily highlight text in WordPress.

Adding text highlight color in WordPress

Why and When to Highlight Text in WordPress

Text highlighting is an easy way to emphasize important information in your content. It helps you direct the user’s attention to details that you don’t want them to miss.

For instance, highlighting a discount offer on your WordPress website in a different color will draw the reader’s attention to it, helping you generate more sales.

Here’s a sample of what text highlighting might look like in a blog post:

Preview for highlighting text in the block editor

Highlighting text in a different color can also help users with visual impairments or reading difficulties to navigate and understand the content more easily. It can even enhance the appearance of your content and make it more visually appealing.

However, highlighting too much text on your page can be distracting and reduce its effectiveness. That’s why we recommend only highlighting very important text like calls to action, warnings, and other details that readers should pay attention to.

That being said, let’s take a look at how to easily highlight text in WordPress. You can use the quick links below to jump to the method you wish to use:

Method 1: Highlight Text in WordPress Using the Block Editor

This method is for you if you want to easily highlight text in WordPress using the block editor.

First, you will need to open up an existing or new post in the block editor from the WordPress admin sidebar.

Once you are there, simply select the text that you want to highlight and then click the ‘More’ icon in the block toolbar at the top.

This will open up a dropdown menu where you must the ‘Highlight’ option from the list.

Expand the More dropdown menu from the block toolbar and select the Highlight option

A color picker tool will now open up on your screen. From here, you will first need to switch to the ‘Background’ tab.

After that, you can choose a default highlight color from the given options.

You can also select a custom color to highlight text by clicking on the ‘Custom’ option to launch an ‘Eyedropper’ tool.

Choose a highlight color from the color picker tool

Finally, don’t forget to click the ‘Publish’ or ‘Update’ button to save your changes.

You can now visit your website to check out the highlighted text in action.

Preview for highlighting text in the block editor

Method 2: Highlight Text in WordPress Using WPCode (Recommended)

If you want to consistently use a specific color to highlight text all over your WordPress website, then this method is for you.

You can easily highlight text in WordPress by adding CSS code to your theme files. However, the smallest error when entering the code could break your website, making it inaccessible.

That’s why we recommend using WPCode, which is the best WordPress code snippet plugin on the market. It is the easiest and safest way to add code to your website without directly editing your theme files.

Create a Code Snippet With WPCode

First, you need to install and activate the free WPCode plugin. For more instructions, please see our beginners’ guide on how to install a WordPress plugin.

Upon activation, head over to the Code Snippets » + Add Snippet page from the WordPress admin sidebar.

Next, just click the ‘Use Snippet’ button under the ‘Add Your Custom Code (New Snippet)’ option.

Add new snippet

This will take you to the ‘Create Custom Snippet’ page, where you can start by typing a name for your code snippet.

After that, you need to select the ‘CSS Snippet’ option from the ‘Code Type’ dropdown menu.

Note: The ‘CSS Snippet’ option is only available in the premium version of WPCode. If you are using the free version, then you will have to select the ‘Universal Snippet’ option instead.

CSS Snippet as code type for the highlighting text in WordPress

Next, click inside the ‘Code Preview box’.

Then, you have to copy and paste the following code:

mark {
background-color: #ffd4a1;
}

Once you have done that, add the hex code for your preferred highlight color next to the background-color line in the code.

In our example, we are using #ffd4a1, which is a light brown color.

Paste the code snippet to highlight text in WordPress

After that, scroll down to the ‘Insertion’ section.

From here, select the ‘Auto Insert’ method to automatically execute the code upon activation.

Choose an insertion method

Next, head to the top of the page and toggle the ‘Inactive’ switch to ‘Active’.

Finally, click the ‘Save Snippet’ button to store your changes.

Save text highlight code snippet

Highlight Text in the Block Editor

Now that the CSS snippet has been activated, we will have to add some HTML code in the block editor to highlight the text in WordPress.

First, open up an existing or new post in the WordPress block editor.

From here, click on the ‘Options’ icon in the block toolbar at the top. This will open up a new dropdown menu where you must select the ‘Edit as HTML’ option.

Choose the edit as HTML option from the Options dropdown menu in the block toolbar

You will now see the block content in HTML format.

Here, simply wrap the text that you want to highlight inside the <mark> </mark> tags like this:

<mark>highlighted-text</mark>

This will highlight the text in the hex color that you choose in your WPCode snippet.

After that, click the ‘Edit Visually’ option in the block toolbar. to switch back to the visual editor.

Write HTML code on both sides of the text that you want to highlight

Once you are done, go ahead and click the ‘Update’ or ‘Publish’ button to save your changes.

Now, you can visit your website to check out the highlighted text in action.

Demo of highlighting text in WordPress

We hope this guide helped you learn how to highlight text in WordPress. You may also want to see our guide on how to customize colors in WordPress to make your website more aesthetically pleasing and our comparison of the best email marketing services to grow your traffic.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

The post How to Highlight Text in WordPress (Beginner’s Guide) first appeared on WPBeginner.

SEO Audit – Link Issues

Featured Imgs 11

Internal links are wrecked One of the ways to rank websites pages in search engines is by swarming their links. If there are deceased links or broken links on your website, it can stop search engine bots from crawling your site and, thus, indexing it. It is good that your website has 0 dead links.

External links are lost anchor text (title) & no follow attribute Counting titles for the links helps search engines and users to better know about the page youre linking to. We must place titles on all the links so that users can simply understand that it is a link and we are connecting to that page.

Internal links are lost anchor text (title) Including title for the links assistances search engines and users to better know about the page youre linking to. We must place titles on all the links so that users can simply understand that it is a link and we are linking to that web page.

Centering in CSS

Category Image 052


Adam Argyle has a post over on web.dev digging into this. He starts with the assumption that you need to do vertical centering and horizontal centering. It’s that vertical centering that has traditionally been a bit trickier for folks, particularly when the height of the content is unknown.

We have a complete guide to centering that covers a wide variety of situations like a decision tree.

Adam details five(!) methods for handling it, even getting into centering unknown vertical and horizontal dimensions, plus a handful of other restraints like language direction and multiple elements. I guess all the silly jokes about the difficulty of centering things in CSS need to be updated. Maybe they should poke fun about how many great ways there are to center things in CSS.

Adam does a great job listing out the pros and cons of all the techniques, and demonstrating them clearly. There is also a video. He picks “the gentle flex” as the winning approach:

.gentle-flex {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1ch;
}

You can always find it in my stylesheets because it’s useful for both macro and micro layouts. It’s an all-around reliable solution with results that match my expectations. Also, because I’m an intrinsic sizing junkie, I tend to graduate into this solution. True, it’s a lot to type out, but the benefits it provides outweighs the extra code.

Remember that when you’re “centering in CSS” it’s not always within these extreme situations. Let’s look at another situation, just for fun. Say you need to horizontally center some inline-*¹ elements… text-align: center; gets you there as a one-liner:

But what if you need to center the parent of those items? You’d think you could do a classic margin: 0 auto; thing, and you can, but it’s likely the parent is block-level and thus either full-width or has a fixed width. Say instead you want it to be as wide as the content it contains. You could make the parent inline-*, but then you need another parent in which to set the text-align on to get it centered.

Stefan Judis talked about this recently. The trick is to leave the element block-level, but use width: fit-content;

The ol’ gentle flex could have probably gotten involved here too, but we’d need an additional parent again. Always something to think about.

  1. What I mean by inline-* is: inline, inline-block, inline-flex, inline-grid, or inline-table. Did I miss any?

Direct Link to ArticlePermalink


The post Centering in CSS appeared first on CSS-Tricks.

You can support CSS-Tricks by being an MVP Supporter.

A font-display setting for slow connections

Featured Imgs 25

Me, I really dislike FOUT. I like that it’s an option, because not displaying text quickly on the web is no good. I know font-display: swap; is popular because it’s good for performance, but that FOUT stuff pains me. Matt Hobbs:

If there’s one thing I’d like readers to take away from this post it’s that font-display: swap is a very good option for users with a fast internet connection. But its infinite swap period could be frustrating for users on very slow and unstable connections. If you have users viewing your site under these conditions (I’m pretty certain you will at some point in time), then it may be worth considering font-display: fallback or even font-display: optional.

Seeeee, I told ya. I like how font-display: optional; totally stops FOUT. The font is either applied super fast, or isn’t used at all (but still downloaded async). Chances are, on the next page load, the font is loaded and cached and will be used.

Note this is about slow connections, not necessarily connections where the user would prefer as little data usage as possible. If that’s the case, check out some of the recent posts we linked up in Responsible, Conditional Loading.


And boy howdy, the Web Performance Calendar this year was just loaded in great articles.

Direct Link to ArticlePermalink


The post A font-display setting for slow connections appeared first on CSS-Tricks.

You can support CSS-Tricks by being an MVP Supporter.

Pros and Cons of Photography and Videography in Visual Marketing

Featured Imgs 23

Do you remember a time when there was only text on the internet? Or when the first images popped up in their glorious blocky low resolution? It seems like a lifetime ago.

 

Streaming services, social media, shops… Images and videos are all around the web today. It’s no wonder we see more and more imagery used for online advertisement as well.

 

There are always aspects to consider to decide the best fit for your project. When choosing your advertising strategy, it’s essential to know the good and the not-so-good about photography and videography for marketing.

Advantages

Look Sharp

Pictures – or better yet, videos – show commitment. They show you take your business seriously and are willing to put effort and money into it, reassuring people, so they trust you and your business more.

Emotional Connection

Studies show our brain reacts strongly to visual stimuli, so images cause stronger emotions than text. You can use media to elicit good feelings from potential clients to perceive you as more trustworthy.

Engagement

People usually lose their focus quickly when scrolling their feeds, so it’s best to avoid long texts on social media. Replace words with images that convey your meaning at a glance, and more people will remember your ad.

Images and videos with a catchy bit of text often prompt more people to comment, which increases your visibility and reach.

 

Things to Consider

Price

While a fantastic tool, creating good visual content might not be cheap, depending on your project. Be sure to consider your budget when planning your marketing strategy. If you’re starting small, it might be best to wait for a bigger announcement to start advertising with images, but it’s an investment that pays off. Facetune filter editor can help in photo editing and in making photos look professional.

Platforms

Videos are still mostly watched on desktops and notebooks, and on average, smartphone and tablet users spend less time watching before scrolling down. News readers notoriously prefer text over video, but some data from the same study shows videos are sought after the most during breaking news.

Harder to Edit

Editing a text is easy. An image, a bit less so. However, an actor’s speech in a video? It’s easier to redo the whole thing, lest it could end up terrible. Carefully think about what you intend to say and make sure any information is correct before finishing up.

Photography vs. Videography

You’ve decided to add visuals to your next marketing campaign. How do you decide between pictures and video?

Price

Pictures will be considerably cheaper than videos in general. Ideal for smaller businesses, they aren’t forgotten on bigger brands. Pictures are essential and favored in some social sites over other types of media. Again, considering the platform and your audience plays an important role in your ad campaign’s success (or not).

Engagement

Videos will usually be more engaging than pictures. They allow you to delve deeper into storytelling and convey more information in a shorter amount of time, being perfect for today’s ever-shorter-focused people.

Platforms

Besides mobile or desktop, you should consider where on the internet you’ll be advertising. Facebook users engage a lot more with videos, while Twitter users prefer images over all other media. Plus, videos require more bandwidth, so mobile users might avoid them more often than pictures.

Summing Up

Using visual media can be a great wait to boost visibility and engagement. Planning is essential for crafting a perfect advertisement campaign. If you have doubts or don’t feel confident heading on alone, try to reach out to a friend who works with online marketing or ask for recommendations to find professionals who can help you.

 

Study your audience and listen to your potential clients’ feedback to figure out what works and what doesn’t and adapt to your target group. There’s no magic formula.

The post Pros and Cons of Photography and Videography in Visual Marketing appeared first on Photoshop Lady.

GMT time conversion to Unix epoch

558fe5180e0e8fc922d31c23ef84d240

I am trying to convert the GMT time into unix epoch (starting from 1970), looks like there is a small bug
in code , i could not get and exhausted.

I see following difference

Non leap years
Expected output: Jan 20 19:00:01 2019 GMT = 1548010801
Actual output: 1548097201 (which is Jan 21 19:00:01 2019 GMT, 1 day difference)

Leap Year
Expected output: Dec 27 14:52:30 2020 GMT = 1609080750

Actual output: 1609253550 (which is Dec 29 14:52:30 2020 GMT, 2 days difference)

I really appreciate any help in finding the problem.

`
#include <stdio.h>
#include <string.h>
#include <time.h>

#define BASE_YEAR 1970

void print_time_readable_format(struct tm tm);
int convert_gmt_date_time_to_tm_format(char* gmt_time_fmt);
int check_year_is_leap_or_normal(int year);
int get_number_of_leap_years_from_base_year(int start_year, int end_year);
int convert_gmt_to_epoch(struct tm tm);

int main()
{
    int epoch = 0;
    //char gmt_time_fmt[] = "Jan 20 19:00:01 2019 GMT";
    //char gmt_time_fmt[] = "Dec 27 14:52:30 2020 GMT";
    char gmt_time_fmt[] = "Jan 01 00:00:00 1970 GMT";
    epoch = convert_gmt_date_time_to_tm_format(gmt_time_fmt);
    printf("time in GMT = %s and epoch is %d\n", gmt_time_fmt, epoch);

    return 0;
}

int convert_gmt_date_time_to_tm_format(char* gmt_time_fmt)
{
    struct tm tm;
    char tm_time_fmt[255];

    //set tm struture to 0
    memset(&tm, 0, sizeof(struct tm));
    // convert gmt_time_fmt to format required by 'tm' structure
    strptime(gmt_time_fmt, "%B %d %H:%M:%S %Y GMT", &tm);

    strftime(tm_time_fmt, sizeof(tm_time_fmt), "%s", &tm);
    printf("tm_time_fmt = %s\n", tm_time_fmt);

    print_time_readable_format(tm);

    return convert_gmt_to_epoch(tm);

    return 0;
}

int convert_gmt_to_epoch(struct tm tm)
{
    int days_by_month [2][12] = {
        /* normal years */
        { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334},
        /* leap years */
        { 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335}
    };

    int current_year = tm.tm_year+1900;

    printf("current_year =%d\n", current_year);

    int total_years_passed = current_year - BASE_YEAR;

    printf("total_years_passed =%d\n", total_years_passed);

    int nleap_years_passed = get_number_of_leap_years_from_base_year(BASE_YEAR, current_year);

    int normal_years = total_years_passed - nleap_years_passed;

    printf("normal_years =%d\n", normal_years);

    int total_days_passed = (normal_years*365 + nleap_years_passed*366 );

    printf("total_days_passed =%d\n", total_days_passed);

    total_days_passed += days_by_month[check_year_is_leap_or_normal(current_year)][tm.tm_mon];

    printf("total_days_passed after adding month =%d\n", total_days_passed);

    total_days_passed += tm.tm_mday;

    printf("total_days_passed after adding day =%d\n", total_days_passed);

    total_days_passed  = total_days_passed*24 + tm.tm_hour;
    total_days_passed  = total_days_passed*60 + tm.tm_min;
    total_days_passed  = total_days_passed*60 + tm.tm_sec;

    printf("total_days_passed final =%d\n", total_days_passed);

    return total_days_passed;

}

int get_number_of_leap_years_from_base_year(int start_year, int end_year)
{
    int leap_year_count = 0;
    int year = start_year;

    while( year <= end_year)
    {
        if(check_year_is_leap_or_normal(year))
            leap_year_count++;
        year++;
    }

    printf("leap_year_count = %d\n", leap_year_count);

    return leap_year_count;
}

int check_year_is_leap_or_normal(int year)
{
    if( ( year%4 == 0 ) && ( ( year%400 == 0 ) || ( year%100 != 0)))
         return 1;
    else
        return 0;
}

void print_time_readable_format(struct tm tm)
{
    printf("tm.tm_year = %d ", tm.tm_year);
    printf("tm.tm_mon = %d ", tm.tm_mon);
    printf("tm.tm_mday = %d ",tm.tm_mday);
    printf("tm.tm_hour = %d ", tm.tm_hour); 
    printf("tm.tm_min = %d ", tm.tm_min );
    printf("tm.tm_sec = %d\n", tm.tm_sec );
}
`