Show Categories
583
5
sticky

what's new in [4.9.1]

  • Fixed compatibility issues with PHP 7.4
  • Notifications tab fix in edit profile
  • Preferences style fix
  • Smiley fix for forum posts
  • Update jquery nestable plugin
  • Vintage theme template and css fixes
  • Security fix in admin category
  • Fixed draggable not working for nested categories
  • Edit avatar fix for firefox

There will be another release(4.9.2) within the next week or two, for a few bug fixes.

The upcoming major revision [5.0], will have some major improvements,

  • We plan to separate cache and uploaded asset storage and code.
  • Some re-structuring to make the code look modern and standard so as to make it easier for people coming for other frameworks to make changes easily.
  • We do plan to keep things backwards compatible and hope to make it a one click upgrade.

Solve below & any other pending bugs from forum:

PS: Thanks to all the contributors, community members and our well wishers, your feedback and appreciation keeps us going smile

Happy Easter!
Stay Home. Stay Safe.

recent by Sandra Stauffer  ·  5 hours ago
1.5k
10
sticky
WebCrew posted Aug 30 '19 at 1:03 am

Hallo Community

because there is no dark theme (style) for Codoforum I created one for myself and I share the result now with the Codo community.

I am not a professional webdesign artist or developer. It is one of my hobbies and even if I love webdesign and already created a lot of projects, I`m sure the theme is far from perfect but it is ready to use.

If You like it or download it give me a thumbs up or leave a comment.

I try to update the theme from time to time and maybe I will integrate some new features too.

Here is the download link:

Kind Regards, Andy

5d6866b05ef1a


5d6866b05ef1a
recent by WebCrew  ·  Jul 7 at 2:06 pm
642
5
sticky
admin posted Jan 6 at 9:39 pm

We have had a few contributors on this forum through the last 5+ years.

So we have decided to announce contributions every month:

@WebCrew
Thank you for your continuous contributions throughout the time. Not only does he help people on the forum, he also contributes directly by sending code and valuable suggestions.

Prasanth c41m
Thank you for your recent contributions and advance notification regarding the recent exploit that you encountered in Codoforum. [We will add more detail here once the patch is out]

recent by quenquen  ·  Apr 1 at 5:02 pm
13
3
timconsidine posted 1 day ago at 6:40 pm

I see that the post_created field is an INT

Is the value a standard representation of a UNIX timestamp

e.g. 07/14/2020 @ 5:36pm (UTC) = 1594748168

Enquiring because importing some posts and want to set the post date to the original one

recent by timconsidine  ·  2 hours ago
17
1
pupsik posted 4 days ago at 5:48 pm

Transliterator is an abstract class that transliterates text from one format to another. Russian to Latin transliterator changes Russian text written in Cyrillic characters to phonetically equivalent Latin characters.

Only useful for Russian speaking community!

Open sites/default/assets/js/editor.js

Add on top right after:

//avoid alt+e and alt+f key combinations

This:

var CapsState = false;

function copy() {
  let textarea = document.getElementById("textarea");
  textarea.select();
  document.execCommand("copy");
}

function initArray() 
{
    this.length = initArray.arguments.length
    for (var i = 0; i < this.length; i++)   
        this[i+1] = initArray.arguments[i]
}

eng_letters = new initArray(1040,1041,1062,1044,1045,1060,1043,1061,1048,1049,1050,1051,1052,1053,1054,1055,1071,1056,1057,1058,1059,1042,1065,1061,1067,1047,91,92,93,94,95,96,1072,1073,1094,1076,1077,1092,1075,1093,1080,1081,1082,1083,1084,1085,1086,1087,1103,1088,1089,1090,1091,1074,1097,120,1099,1079);
second_order = new initArray(72,79,69,85,65,72,77,79,85,65,72,104,111,101,117,97,104,109,111,117,97,104);
first_order  = new initArray(1062,1049,1049,1049,1049,1057,1065,1067,1067,1067,1047,1094,1081,1081,1081,1081,1089,1097,1099,1099,1099,1079);
two_result = new initArray(1063,1025,1069,1070,1071,1064,1068,1025,1070,1071,1046,1095,1105,1101,1102,1103,1096,1100,1105,1102,1103,1078);

var nexto = 1;
var language = (navigator.appName=='Netscape');

function getlanguagename()
{
    if (language==1) return "Eng";
    if (language==0) return "Rus";
}

function changelanguage()
{
if (language==1) {language=0; document.translitform.rus_eng.value="Rus"; document.translitform.input_text.focus();return 0}
if (language==0) {language=1; document.translitform.rus_eng.value="Eng"; document.translitform.input_text.focus();return 0}
}

function translate_letter()
{
    if(navigator.appName=='Netscape')
    {
        if (language==0) 
        {
            changelanguage();
            alert("The language is swithched to English. Please complete the text and press 'TRANSLITERATE ALL' button");
        }
        return true;
    }
        if (language==1) {return true;}
    var txt = document.translitform.input_text.value;
    l1 = txt.substr(txt.length - 1,1);
    var code = l1.charCodeAt(0); 
    l2 = txt.substr(txt.length-2,1);
    var code2 = l2.charCodeAt(0);
    if ((code==39)||(code==35))
    //' and '' and # and ## treatment
    {
        if (code==39) 
        {
            var newcode =1100;
            var doublecode =1068;
        }
        if (code==35) 
        {
            var newcode =1098;
            var doublecode =1066;
        }

        var res = String.fromCharCode(newcode);        
        txt = txt.substr(0, txt.length-1);
        if (code2==newcode) 
        { 
            res = String.fromCharCode(doublecode);
            txt = txt.substr(0, txt.length-1);
        }

        document.translitform.input_text.value = txt + res;
                document.translitform.input_text.focus();
    }

    if ((code<123) && (code>64)) 
    {
        var res = String.fromCharCode(eng_letters[code-64]);
        var rus_code = eng_letters[code-64];
        txt = txt.substr(0, txt.length-1);
        if (nexto==0)
        { 
            nexto = 1;
            for (i = 1; i<25; i++)
            {
                if (rus_code == first_order[i]) nexto = 0; 
                if ((code==second_order[i])&&(code2==first_order[i])) 
                { 
                    res = String.fromCharCode(two_result[i]);
                    txt = txt.substr(0, txt.length-1);
                    break;
                }
            }
        }
        else nexto = 0;

                document.translitform.input_text.focus();
        document.translitform.input_text.value = txt + res;

    }
}


function translatesymbol(pretxt,txt)
{
    var res = pretxt+txt;
    var code = txt.charCodeAt(0); 
    var code2 = pretxt.charCodeAt(0);

    if ((code==39)||(code==35))
    //' and '' and # and ## treatment
    {
        if (code==39) 
        {
            var newcode =1100;
            var doublecode =1068;
        }
        if (code==35) 
        {
            var newcode =1098;
            var doublecode =1066;
        }

        res = pretxt+String.fromCharCode(newcode);        

        if (code2==newcode) 
        { 
            res = String.fromCharCode(doublecode);
        }
    }

    if ((code<123) && (code>64)) 
    {
        res = pretxt+String.fromCharCode(eng_letters[code-64]);
        for (i = 1; i<25; i++)
        { 
            if ((code==second_order[i])&&(code2==first_order[i])) 
            { 
                res = String.fromCharCode(two_result[i]);
                break;
            }
        }
    }
    return res;
}

function translateAll()
{
    var txt = document.translitform.input_text.value;
    var txtnew = translatesymbol("",txt.substr(0,1));
    var symb = "";
    for (kk=1;kk<txt.length;kk++)
    {
        symb = translatesymbol(txtnew.substr(txtnew.length-1,1),txt.substr(kk,1));
        txtnew = txtnew.substr(0,txtnew.length-1) + symb;
    }
    document.translitform.input_text.value = txtnew;
    document.translitform.input_text.focus();
}

     function onClickKBButtonEx(btn)
     {
    if (btn == 'Caps')
        CapsState = !(CapsState)
        else
    { 
        var txt = document.translitform.input_text.value;
        if (btn == 'BkSp')
        {
            txt = txt.substr(0, txt.length - 1);
        }
        else
        {
            txt = txt + btn;
        }
        document.translitform.input_text.value = txt;
    }
        document.translitform.input_text.focus();
     }
     function onClickKBButton(btn)
     {
    var code = btn.charCodeAt(0);
    if (CapsState == false)
    {
        if (code == 168) 
                   code = 184;
        else if (code == 1025)
           code = 1105;
        else
                   code = code + 32;
    }
    btn = String.fromCharCode(code);
    onClickKBButtonEx(btn);
     }

Find:

],
    previewInElement: jQuery('#codo_new_reply_preview'),

Add Before:

{name: 'Translit', className: "translit", replaceWith: translateAll},

(That is if you are using my colors and headers bbcode change)
Save and close.

open sites/default/themes/default/less/editor.less

Find:

.markItUp .preview a {
    background-image:url(../img/preview.png);
}

Add before:

.markItUp .translit {
   left: 340px;
   position: absolute;
}
.markItUp .markItUpButton13 a    {
    background-image:url(../img/translit.png);
}

Add image to sites/default/themes/default/img
5f09f48d20b38

Open sites/default/themes/default/templates/forum/new_topic.tpl
Find:

<form id="codo_new_reply_post"  method="POST" class="" role="form">

Replace with:

<form method="post" id="codo_new_reply_post" onsubmit="return false;" name="translitform" enctype="multipart/form-data" role="form">

Find:

<textarea placeholder="{_t('Describe your topic . You can use BBcode or Markdown')}" id="codo_new_reply_textarea" name="input_text">{$topic.imessage}</textarea>

Open sites/default/themes/default/templates/forum/topic.tpl

Find:

<form id="codo_new_reply_post" action="/" method="POST">

Replace with:

<form id="codo_new_reply_post" action="/" onsubmit="return false;" name="translitform" enctype="multipart/form-data" method="POST">

Find:

<textarea placeholder="{_t('Start typing here . You can use BBcode or Markdown')}" id="codo_new_reply_textarea" name="input_text"></textarea>

Replace with:

<textarea onkeyup="translate_letter()" placeholder="{_t('Start typing here . You can use BBcode or Markdown')}" id="codo_new_reply_textarea" name="input_text"></textarea>

Done!


5f09f48d20b38
recent by pupsik  ·  4 days ago at 6:28 pm
457
20

Hello,

So...i've just started using codoforum, wich is a very nice and smooth forum platform, congrats to the developer/s.
I've been editing the default theme to try and create a gaming one, with a slider and other nice features. Here's a preview hope you like it and give some opinions and sugestions.

The template is still in the works, this week should be available on github, i'll update this topic.

Kind regards,
ALCHEM;.

PS: Sorry for my bad english smile


recent by ALCHEM;  ·  Jul 7 at 7:04 pm
30
1
pupsik posted Jun 24 at 6:37 pm

Russian Language Pack v4.9.4

Here it is:

Note: translated 100% (not admin panel). Every line has been hand translated. There is no better alternatives out there. smile

@admin there is misspell in "password" english lang pack line 450

'passowrd cannot be less than ' => 'passowrd cannot be less than ',

Missing line in en_US:

'Edit Profile' => 'Edit Profile',

Lines need to be replaces to read language files.

sites/default/themes/default/templates/user/profile/edit.tpl

line 281:

<div class=""><span>{_t("General")}</span></div>

line 375:

<div class=""><span>{_t("Notification level")}</span></div>

line 90:

<div class=""><span>{_t("Edit Profile")}</span></div>

line 412:

<div class=""><span>{_t("Categories")}</span></div>

line 437

<div class=""><span>{_t("Topics")}</span></div>
recent by admin  ·  Jul 6 at 3:02 pm
102
4

Hallo Community,
Hallo @admin & @adesh

Many Internet users want to use a day and night mode in our time. I thought about this topic and I think our awesome Codologic Team should be able to enable this feature for us in the future with only little effort.

I already wrote the following CSS to help the Codologic Team a little.

This code recognizes whether the user uses the browser integrated day and night mode which is already supported by most modern browsers and has activated the night or day theme.

If a user uses night mode, Codoforum will also be available in dark colors in the future.

Here is the CSS (yes it is very small but completely sufficient):

@media (prefers-color-scheme: dark) {
  img {
    opacity: .75;
    transition: opacity .5s ease-in-out;
  }
  img:hover {
    opacity: 1;
  }

  html {
  --text-color-normal: #0a244d;
  --text-color-light: #8cabd9;
  }

html[data-theme='dark'] {
  --text-color-normal: hsl(210, 10%, 62%);
  --text-color-light: hsl(210, 15%, 35%);
  --text-color-richer: hsl(210, 50%, 72%);
  --text-color-highlight: hsl(25, 70%, 45%);
  }
}

If wanted You can check if the browser supports it using Javascript:

if (window.matchMedia('(prefers-color-scheme)').media === 'not all') {
  console.log('Browser doesn\'t support dark mode');
}

Good luck and thanks for Your interest,
Andy

recent by pupsik  ·  Jun 25 at 8:44 pm
13
1

Here is a slution worked out by our member @pupsik about how you can have some text color option within the forums editor.

Tutorial starts here:

Please note, this is pupsik`s edit and it works, it might not be the best solution or someone might did it different. The pictures he used are original MarkitUp images to fit the style. You may use any others.

Open: sites/default/assets/js/editor.js

Find:

{name: 'Headers', className: "heading", dropMenu: [
Replace with:

{separator:'---------------' },
      {name:'Colors', className: "colors", key: 'C', openWith:'[color=[![Color]!]]', closeWith:'[/color]', dropMenu: [
      {name:'Yellow', openWith:'[color=yellow]', closeWith:'[/color]', className:"col1-1" },
      {name:'Orange', openWith:'[color=orange]', closeWith:'[/color]', className:"col1-2" },
      {name:'Red', openWith:'[color=red]', closeWith:'[/color]', className:"col1-3" },
      {name:'Blue', openWith:'[color=blue]', closeWith:'[/color]', className:"col2-1" },
      {name:'Purple', openWith:'[color=purple]', closeWith:'[/color]', className:"col2-2" },
      {name:'Green', openWith:'[color=green]', closeWith:'[/color]', className:"col2-3" },
      {name:'White', openWith:'[color=white]', closeWith:'[/color]', className:"col3-1" },
      {name:'Gray', openWith:'[color=gray]', closeWith:'[/color]', className:"col3-2" },
      {name:'Black', openWith:'[color=black]', closeWith:'[/color]', className:"col3-3" }
  ]},


  {name: 'Headers', className: "fonts", dropMenu: [

Open: sites/default/themes/default/less/editor.less

Find:

.markItUp .markItUpButton9 a    {
    background-image:url(../img/smileyimg.png);
}
Add after:

.markItUp .colors {
   left: 300px;
   position: absolute;
}

.markItUpHeader .colors ul{
    top: 23px;
    z-index:300;
}

.markItUpHeader .markItUpButton11 a {
    background-image:url(../img/colors.png);
    top: 23px;
    z-index:300;
}

    .markItUpHeader .markItUpButton11 ul {
        width:81px;
        padding:1px;

    }
    .markItUpHeader .markItUpButton11  li {
        border:1px solid white;
        width:25px;    height:25px;
        overflow:hidden;
        padding:0px; margin:0px;
        float:left;    
    }

    .markItUpHeader .markItUpButton11 ul a {
        width:25px;    height:25px;
    }

    .markItUpHeader .markItUpButton11 ul a:hover {
        background-color:none;
    }

    .markItUp .markItUpButton11 .col1-1 a {
        background:yellow;
    }
    .markItUp .markItUpButton11 .col1-2 a {
        background:orange;
    }
    .markItUp .markItUpButton11 .col1-3 a {
        background:red;
    }

    .markItUp .markItUpButton11 .col2-1 a {
        background:blue;
    }
    .markItUp .markItUpButton11 .col2-2 a {
        background:purple;
    }
    .markItUp .markItUpButton11 .col2-3 a {
        background:green;
    }

    .markItUp .markItUpButton11 .col3-1 a {
        background:white;
    }
    .markItUp .markItUpButton11 .col3-2 a {
        background:gray;
    }
    .markItUp .markItUpButton11 .col3-3 a {
        background:black;
    }


.markItUp .fonts {
   left: 320px;
   position: absolute;
}

.markItUpHeader .fonts ul{
    top: 23px;
    z-index:300;
}

.markItUp .markItUpButton12 a {
    background-image:url(../img/fonts.png);
}

.markItUpHeader .markItUpButton12  li {

        border:1px solid white;
        overflow:hidden;
        padding:0px; margin:0px;
        float:left;
}
.markItUp .markItUpButton12 .header1 > a{
    background-image:none;
    font-size: 2em;
    font-weight: bold;
    line-height: 33px;
    height: 43px;
}

.markItUp .markItUpButton12 .header2 > a{
    background-image:none;
    font-size: 1.5em;
    font-weight: bold;
    line-height: 33px;
    height: 43px;

}
.markItUp .markItUpButton12 .header3 > a{
    background-image:none;
    font-size: 1.17em;
    font-weight: bold;
    line-height: 33px;
    height: 43px;

}
.markItUp .markItUpButton12 .header4 > a{
    background-image:none;
    font-size: 1em;
    font-weight: bold;
    line-height: 20px;
    height: 30px;
}
.markItUp .markItUpButton12 .header5 > a{
    background-image:none;
    font-size: .83em;
    font-weight: bold;
    line-height: 20px;
    height: 30px;
}
.markItUp .markItUpButton12 .header6 > a{
    background-image:none;
    font-size: .75em;
    font-weight: bold;
    line-height: 20px;
    height: 30px;
}
Note! Add styles to the theme you are using or to all of them.
Optional: I no longer use headers as a style, so I deleted this:

.markItUp .heading {
    border-radius: 2px;
    -webkit-box-shadow: rgba(255, 255, 255, 0.0980392) 1px 1px inset, rgba(0, 0, 0, 0.0980392) 1px 1px;
    box-shadow: rgba(255, 255, 255, 0.0980392) 1px 1px inset, rgba(0, 0, 0, 0.0980392) 1px 1px;
    background-image: -webkit-linear-gradient(top, rgba(255, 255, 255, 0.0980392), transparent);
    background-repeat: repeat-x;
    background-color: @markItUpHeadingBg;
    color: @markItUpHeadingColor;
    border-color: rgba(0, 0, 0, 0.298039);
    .transition(0.3s linear box-shadow);
    padding-bottom: 0px;
    padding-top: 2px;
    padding-right: 4px;
    margin-left: 10px;
    margin-top: 7px;
    position: absolute;
    left: 280px;    
}


.markItUpHeader .heading:hover {

    border-color: @markItUpHeadingHoverBorder;
}

.markItUp .heading:hover {
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00000000', endColorstr='#1a000000', GradientType=0);
    background-image: -webkit-gradient(linear, 0 0, 0 100%, from(transparent), color-stop(40%, rgba(0, 0, 0, 0.05)), to(rgba(0, 0, 0, 0.1)));
    background-image: -webkit-linear-gradient(transparent, rgba(0, 0, 0, 0.05) 40%, rgba(0, 0, 0, 0.1));
    background-image: -moz-linear-gradient(top, rgba(0, 0, 0, 0.05) 0, rgba(0, 0, 0, 0.1));
    background-image: -ms-linear-gradient(transparent, rgba(0, 0, 0, 0.05) 40%, rgba(0, 0, 0, 0.1));
    background-image: -o-linear-gradient(transparent, rgba(0, 0, 0, 0.05) 40%, rgba(0, 0, 0, 0.1));
    background-image: linear-gradient(transparent, rgba(0, 0, 0, 0.05) 40%, rgba(0, 0, 0, 0.1));

}

.markItUpHeader .heading > a{

    text-indent: 0;
    width: 50px;
    height: 20px;
    text-align: center;
    cursor: pointer;
    color: @markItUpHeading_A_color;
}


.markItUpHeader > ul > li > a {

    background-size: contain;
}

.markItUp .heading > ul > li > a {

    width: 100%;

}

.markItUp .heading .header1 > a{

    font-size: 2em;
    font-weight: bold;
    line-height: 33px;
    height: 43px;
}

.markItUp .heading .header2 > a{

    font-size: 1.5em;
    font-weight: bold;
    line-height: 33px;
    height: 43px;

}
.markItUp .heading .header3 > a{

    font-size: 1.17em;
    font-weight: bold;
    line-height: 33px;
    height: 43px;

}
.markItUp .heading .header4 > a{

    font-size: 1em;
    font-weight: bold;
    line-height: 20px;
    height: 30px;
}
.markItUp .heading .header5 > a{

    font-size: .83em;
    font-weight: bold;
    line-height: 20px;
    height: 30px;
}
.markItUp .heading .header6 > a{

    font-size: .75em;
    font-weight: bold;
    line-height: 20px;
    height: 30px;
}


.markItUpHeader .heading ul{

    background: white;
    border: 1px solid @markItUpHeaderHeadingUlBorder;
    top: 23px;
    left: -1px;
    padding: 6px 0px;
    width: 200px;
    z-index:300;

}

.markItUpHeader .heading ul li {

    text-align: left;
    line-height: 8px;
    border-bottom: 0;
    margin: 0;
    padding: 0;
}

That's it. You can now add 2 images colors.png and fonts.png to your theme. Default sites/default/themes/default/img. Overridte existing images if you feel like it.

Enjoy!

Kind regards from Andy and @pupsik smile

recent by pupsik  ·  Jun 25 at 1:43 am
71
10
pupsik posted Jun 19 at 3:02 pm

As I checked the code, main function to change the text color is there. But it is not included in bbcode header.

So I tryd adding color function from markitup to:
sites/default/assets/markitup/sets/default

No change, no wonder it is using functions from:
sites/default/assets/js/editor.js

So I tryd to add color pics to that, but it overrides existing code?

I don't understand why it is not using normal bbcode from here:
sites/default/assets/markitup/sets/default

How do i change the layout to use default set.js and not editor.js?

recent by pupsik  ·  Jun 24 at 12:12 pm
35
3
frez posted Jun 9 at 12:11 am

Hi

I want to know if someone has the experience of installing Codologic on a Siteground host by himself ... or if Codologic team has advice about it = possible, difficult, impossible ?

Other question : does someone can tell me how much words has the file for translations ? does someone knows if a french version has been made by a know user ?

All the best for everyone around here

Regards

recent by WebCrew  ·  Jun 15 at 11:39 pm
16
1

Hi

I tried with the fr_FR language but also with the en_EN =

I can set a vote at the end of writing a post, but problem, it does not display.

Can't find anything in the doc about any spec or mod to activate to make the votes work

That's why I am here to ask to the delightful community smile

wiil [at] online . fr to ask for the url and an admin access or anything

Merry good day to all

F

recent by WebCrew  ·  Jun 15 at 11:35 pm
24
2
frez posted Jun 9 at 10:08 am

Hi

Before installing, I have a question = is it possible to restrict some topics in a codoforum as private for only a certain category of users

Thanks to the community

May you have a bright stimulant day !

recent by frez  ·  Jun 15 at 10:17 am
51
1

Hello, I am trying to install the forum over https, but I don't get past step 2. I use https standard and the step 3 is being stopped because of the XMLHttpRequest cannot load due to access control checks. I am getting frustrated by this big time.

additional I get this:
Fatal error: Uncaught PDOException: SQLSTATE[HY000] [1698] Access denied for user 'root'@'localhost' in public_html/forum/sys/vendor/illuminate/database/Illuminate/Database/Connectors/Connector.php:47 Stack trace: #0 public_html/forum/sys/vendor/illuminate/database/Illuminate/Database/Connectors/Connector.php(47): PDO->__construct('mysql:host=loca...', 'root', 'root', Array) #1 public_html/forum/sys/vendor/illuminate/database/Illuminate/Database/Connectors/MySqlConnector.php(20): Illuminate\Database\Connectors\Connector->createConnection('mysql:host=loca...', Array, Array) #2 public_html/forum/sys/vendor/illuminate/database/Illuminate/Database/Connectors/ConnectionFactory.php(59): Illuminate\Database\Connectors\MySqlConnector->connect(Array) #3 public_html/forum/sys/vendor/illuminate/database/Illuminate/Database/Connectors/ConnectionFactory.php(47): Illuminate\Database\Connectors\ConnectionFactory->createSingleConnection(Array) #4 /U in public_html/forum/sys/vendor/illuminate/database/Illuminate/Database/Connectors/Connector.php on line 47

it seems it does not take the give login name and password set in step 2

recent by WebCrew  ·  Jun 12 at 11:23 pm
15
1
michael maser posted Jun 12 at 9:47 pm

Hello,

I'm just exploring Codoforum with school use in mind. I like the clean UI, but I haven't found messaging or any indication really that CF has been adapted for school use. Does anyone know about this?

Thank you in advance,
Michael Maser
BC Canada

recent by WebCrew  ·  Jun 12 at 11:19 pm
15
0
Adamstiffman posted Jun 7 at 10:53 am

Learn about all date function which is used to manipulate in the SQL server with the help of Date function in SQL for example - CURRENT_TIMESTAMP function in SQL, DATEADD, DATENAME.

CURRENT_TIMESTAMP function in SQL : -

SQL gives a function to the user which helps to return the current date and time in the SQL server and that function is known as CURRENT_TIMESTAMP function.

Syntax : - 
CURRENT_TIMESTAMP

This function gives date and time in the format 'yyyy-mm-dd hh:mm:ss.mmm'.

See the example : -

SELECT CURRENT_TIMESTAMP;
Result: '2014-05-01 14:19:55.918'

DATEADD function in SQL : -
DATEADD function in SQL helps to give a date after adding or subtracting the interval from the date.

Syntax:- 
DATEADD( interval, number, date )

Example : -


SELECT DATEADD(year, 1, '2014/05/29');
Result: '2015-05-29 00:00:00.000'

SELECT DATEADD(year, 1, '2014/05/29');
Result: '2015-05-29 00:00:00.000'

SELECT DATEADD(year, 1, '2014/05/29');
Result: '2015-05-29 00:00:00.000'

SELECT DATEADD(year, -1, '2014/03/23');
Result: '2013-03-23 00:00:00.000'

SELECT DATEADD(month, 1, '2014/09/18');
Result: '2014-09-18 00:00:00.000'

SELECT DATEADD(month, -1, '2014/04/28');
Result: '2014-03-28 00:00:00.000'

SELECT DATEADD(day, 1, '2014/04/28');
Result: '2014-04-29 00:00:00.000'

SELECT DATEADD(day, -1, '2014/04/28');
Result: '2014-04-27 00:00:00.000'

DATEDIFF function in SQL : -
DATEDIFF function tells about the between two date values, based on the interval specified.

Syntax:- 
DATEDIFF( interval, date1, date2 )

The interval used to calculate the difference between date1 and date2.

Example : -


SELECT DATEDIFF(year, '2012/01/18', '2014/01/28');
Result: 2

SELECT DATEDIFF(yyyy, '2010/04/28', '2012/04/28');
Result: 2

SELECT DATEDIFF(yy, '2010/04/28', '2012/04/28');
Result: 2

SELECT DATEDIFF(month, '2014/01/01', '2014/04/28');
Result: 3

SELECT DATEDIFF(day, '2014/01/01', '2014/04/28');
Result: 117

SELECT DATEDIFF(hour, '2014/04/28 08:00', '2014/04/28 10:45');
Result: 2

SELECT DATEDIFF(minute, '2014/04/28 08:00', '2014/04/28 10:45');
Result: 165

DATENAME in SQL : -
DATENAME function in SQL gives the specified part of the of a given date, as a string value

Syntax:- 
DATENAME( interval, date )

it will return the result in the string.

Example : -

SELECT DATENAME(year, '2014/04/28');
Result: '2014'

SELECT DATENAME(yyyy, '2012/04/28');
Result: '2012'

SELECT DATENAME(yy, '2010/04/28');
Result: '2010'

SELECT DATENAME(month, '2014/01/28');
Result: 'Jan'

SELECT DATENAME(day, '2014/04/19');
Result: '19'

SELECT DATENAME(quarter, '2014/04/28');
Result: '2'

SELECT DATENAME(hour, '2014/04/28 09:49');
Result: '9'

SELECT DATENAME(minute, '2014/04/28 09:49');
Result: '49'

SELECT DATENAME(second, '2014/04/28 09:49:12');
Result: '12'

SELECT DATENAME(millisecond, '2014/04/28 09:49:12.726');
Result: '726'

DATEPART in SQL : -

DATEPART function in SQL gives the specified part of the of a given date, as an integer value.

Syntax:- 
DATEPART( interval, date )

it will return the result in the integer.

Example : -



SELECT DATENAME(year, '2014/04/28');
Result: '2014'

SELECT DATENAME(yyyy, '2012/04/28');
Result: '2012'

SELECT DATENAME(yy, '2010/04/28');
Result: '2010'

SELECT DATENAME(month, '2014/01/28');
Result: '1'

SELECT DATENAME(day, '2014/04/19');
Result: '19'

SELECT DATENAME(quarter, '2014/04/28');
Result: '2'

SELECT DATENAME(hour, '2014/04/28 09:49');
Result: '9'

SELECT DATENAME(minute, '2014/04/28 09:49');
Result: '49'

SELECT DATENAME(second, '2014/04/28 09:49:12');
Result: '12'

SELECT DATENAME(millisecond, '2014/04/28 09:49:12.726');
Result: '726'

DATEPART in SQL : -
DAY function tells about the day of the month (between 1 to 31) given a date value.

Syntax:- 
DAY( date_value )

Example : -


SELECT DAY('2014/04/22');
Result: 22

SELECT DAY('2014/03/23 10:05');
Result: 23

SELECT DAY('2014/04/11 10:05:18.621');
Result: 11

````GETDATE SQL function : -
GATEDATE function in SQL gives you the current date and time just like the CURRENT_TIMESTAMP function.

Syntax:-
GETDATE ( )


Example : -

SELECT GETDATE();
Result: '2014-04-28 18:17:28.160'

````GETUTCDATE SQL function : -
GETUTCDATE function for SQL server returns the current UTC date and time.

Syntax:-
GETUTCDATE ( )

Example : - 
SELECT GETUTCDATE();
Result: '2014-04-29 00:27:58.657'

MONTH Function in SQL : -
MONTH function tells about the MONTH of the month (between 1 to 12) given a date value.

Syntax:- 
MONTH( date_value )
Example : - 


SELECT MONTH('2014/02/28');
Result: 2

SELECT MONTH('2014/01/31 10:05');
Result: 1

SELECT MONTH('2014/10/01 10:05:18.621');
Result: 10

MONTH Function in SQL : -

MONTH function tells about the four-digit year (in number) given a date value.

Syntax:-

YEAR( date_value )

Example : -

```` 
SELECT YEAR('2012/04/28');
Result: 2012

SELECT YEAR('2009/03/31 10:05');
Result: 2009

SELECT YEAR('2011/12/01 10:05:18.621');
Result: 2011

````

9
1

Hi @admin

the "blog" here does report an error:

Fatal error: Uncaught PDOException: could not find driver in /usr/share/nginx/html/iwstack/landing-page/pages/blog/connect.php:6 Stack trace: #0 /usr/share/nginx/html/iwstack/landing-page/pages/blog/connect.php(6): PDO->__construct('sqlite:pages/bl...'smile #1 /usr/share/nginx/html/iwstack/landing-page/pages/blog/list_posts.php(4): require('/usr/share/ngin...'smile #2 /usr/share/nginx/html/iwstack/landing-page/pages/blog.php(41): require('/usr/share/ngin...'smile #3 /usr/share/nginx/html/iwstack/landing-page/index.php(30): include('/usr/share/ngin...'smile #4 /usr/share/nginx/html/iwstack/landing-page/index.php(62): get_contents('pages/blog.php'smile #5 {main} thrown in /usr/share/nginx/html/iwstack/landing-page/pages/blog/connect.php on line 6

Kind regards, Andy

recent by admin  ·  Jun 5 at 10:38 am
20
1
dilipjadhav posted Jun 2 at 6:45 am

I have a login form i'm trying to get working yet when I hit submit the username and password I type in just disappears! I really have no idea what I broke this time.

Login Form

        <form class="form-signin" action="login.php" method="post">
          <div class="form-label-group">
            <input type="text" name="user" id="user" class="form-control" placeholder="User ID" required>
            <label for="user">Username</label>
          </div>
          <div class="form-label-group">
            <input type="password" name="pass" id="pass" class="form-control" placeholder="Password" required>
            <label for="pass">Password</label>
          </div>
          <p>logins are automatically remembered for 60 days. use the <a href="signout.php">signout</a> page to sign out. </p>
          <button class="btn btn-lg btn-primary btn-block text-uppercase" type="submit">Sign in</button>
        </form>
recent by WebCrew  ·  Jun 2 at 8:13 am
Categories
Actions
Hide topic messages
Enable infinite scrolling
All posts under this topic will be deleted ?
Previous
1234 ... 137
Next
Pending draft ... Click to resume editing
Discard draft