Kamis, 06 Mei 2021

TANGGAL-di web

 

2 Cara Menampilkan Tanggal Dan Waktu Di Halaman Website

Menampilkan Tanggal Dan Waktu Menggunakan JavaScript atau PHP

Pada kesempatan kali ini saya akan menampilkan tanggal dan waktu pada suatu halaman website menggunakan JavaScript atau PHP. Tanggal dan waktu berguna bagi pengunjung website mengetahui kapan suatu konten di website Anda diterbitkan. Hal ini dapat dilakukan dengan beberapa cara. Berikut kodenya.

1. Menampilkan Tanggal Dan Waktu Menggunakan JavaScript (Client-side)

Jika menggunakan metode ini, maka tampil tanggal dan waktu sesuai jam sistem pengunjung website. Yang pertama kali harus Anda siapkan adalah di mana tanggal dan waktu ingin ditampilkan pada halaman website. Hal ini bisa dilakukan dengan menambahkan id pada elemen <p> atau <span>.

CATATAN: Hari yang digunakan sebagai contoh adalah : 19 Februari 2020

Contoh Menggunakan elemen <span>

<p>Tanggal/Waktu: <span id="tanggalwaktu"></span></p>

Contoh Menggunakan elemen <p>

<p>Tanggal/Waktu:</p>
<p id="tanggalwaktu"></p>

Nah, berikutnya adalah menentukan/memasangkan date/time ke konten Anda (HTML) yang memiliki id=”tanggalwaktu”

<p>Tanggal/Waktu: <span id="tanggalwaktu"></span></p>
<script>
var dt = new Date();
document.getElementById("tanggalwaktu").innerHTML = dt.toLocaleString();
</script>

Hasil : Tanggal/Waktu: 2/19/2020, 2:50:48 PM

 

Jika Anda hanya ingin menampilkan tanggal saat ini saja:

<p>Tanggal/Waktu: <span id="tanggalwaktu"></span></p>
<script>
var dt = new Date();
document.getElementById("tanggalwaktu").innerHTML = dt.toLocaleDateString();
</script>

Hasil : Tanggal/Waktu: 2/19/2020

 

Jika Anda hanya ingin menampilkan waktu saat ini saja:

<p>Tanggal/Waktu: <span id="tanggalwaktu"></span></p>
<script>
var dt = new Date();
document.getElementById("tanggalwaktu").innerHTML = dt.toLocaleTimeString();
</script>

Hasil : Tanggal/Waktu: 2:51:51 PM

 

Dengan menggunakan fungsi “toLocaleString” pada kode, maka output yang tampil akan tergantung waktu lokal pengguna. Kode ini mungkin sudah tampil dengan baik, namun bagaimana jika Anda ingin menampilkannya dengan format tertentu? Misal format DD.MM.YYY hh:mm bisa Anda ganti dengan MM.DD.YYY hh:mm. Solusinya ada sebagai berikut:

 

Contoh MM/DD/YYYY hh:mm

<p>Tanggal/Waktu: <span id="tanggalwaktu"></span></p>
<script>
var dt = new Date();
document.getElementById("tanggalwaktu").innerHTML = (("0"+(dt.getMonth()+1)).slice(-2)) +"/"+ (("0"+dt.getDate()).slice(-2)) +"/"+ (dt.getFullYear()) +" "+ (("0"+dt.getHours()+1).slice(-2)) +":"+ (("0"+dt.getMinutes()+1).slice(-2));
</script>

Hasil : Tanggal/Waktu: 02/19/2020 41:71

 

Contoh DD.MM.YYYY hh:mm

<p>Tanggal/Waktu: <span id="tanggalwaktu"></span></p>
<script>
var dt = new Date();
document.getElementById("tanggalwaktu").innerHTML = (("0"+dt.getDate()).slice(-2)) +"."+ (("0"+(dt.getMonth()+1)).slice(-2)) +"."+ (dt.getFullYear()) +" "+ (("0"+dt.getHours()).slice(-2)) +":"+ (("0"+dt.getMinutes()).slice(-2));
</script>

Hasil : Tanggal/Waktu: 19.02.2020 14:46

Pada kode di atas, kita tambahkan angka 0 di depan angka single digit (misal 1, 2, 3, dst) supaya lebih bagus dilihat.

Baca Juga : Apa Itu Private Browsing Dan Bagaimana Private Browsing Dapat Membantu Anda?

Menampilkan nama bulan dan nama hari

<p>Tanggal/Waktu: <span id="tanggalwaktu"></span></p>
<script>
var tw = new Date();
if (tw.getTimezoneOffset() == 0) (a=tw.getTime() + ( 7 *60*60*1000))
else (a=tw.getTime());
tw.setTime(a);
var tahun= tw.getFullYear ();
var hari= tw.getDay ();
var bulan= tw.getMonth ();
var tanggal= tw.getDate ();
var hariarray=new Array("Minggu,","Senin,","Selasa,","Rabu,","Kamis,","Jum'at,","Sabtu,");
var bulanarray=new Array("Januari","Februari","Maret","April","Mei","Juni","Juli","Agustus","September","Oktober","Nopember","Desember");
document.getElementById("tanggalwaktu").innerHTML = hariarray[hari]+" "+tanggal+" "+bulanarray[bulan]+" "+tahun;
</script>

Hasil : Tanggal/Waktu: Rabu, 19 Februari 2020

Menampilkan Nama Bulan, Hari, dan Jam Saat Ini

<p>Tanggal/Waktu: <span id="tanggalwaktu"></span></p>
<script>
var tw = new Date();
if (tw.getTimezoneOffset() == 0) (a=tw.getTime() + ( 7 *60*60*1000))
else (a=tw.getTime());
tw.setTime(a);
var tahun= tw.getFullYear ();
var hari= tw.getDay ();
var bulan= tw.getMonth ();
var tanggal= tw.getDate ();
var hariarray=new Array("Minggu,","Senin,","Selasa,","Rabu,","Kamis,","Jum'at,","Sabtu,");
var bulanarray=new Array("Januari","Februari","Maret","April","Mei","Juni","Juli","Agustus","September","Oktober","Nopember","Desember");
document.getElementById("tanggalwaktu").innerHTML = hariarray[hari]+" "+tanggal+" "+bulanarray[bulan]+" "+tahun+" Jam " + ((tw.getHours() < 10) ? "0" : "") + tw.getHours() + ":" + ((tw.getMinutes() < 10)? "0" : "") + tw.getMinutes() + (" W.I.B ");
</script>

Hasil : Tanggal/Waktu: Rabu, 19 Februari 2020 Jam 14:44 W.I.B

2. Menampilkan Tanggal Dan Waktu Menggunakan PHP (Server-side)

Penting: Kode ini untuk menampilkan Tanggal/Waktu sesuai tanggal dan waktu di server Anda.

Jika Anda ingin menampilkan tanggal dan waktu dari sisi klien, gunakan kode JavaScript di atas.

<!doctype html>
<html lang="en">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body>
// Asumsi hari ini adalah 11 Maret 1990 maka akan tampil 03/11/1990 17:30
<p>Tanggal/Waktu: MM/DD/YYYY hh:mm<br>
<?php echo date('m/j/Y H:i'); ?></p>
// Asumsi hari ini adalah 11 Maret 1990 maka akan tampil 11/03/1990 17:30
<p>Tanggal/Waktu: DD.MM.YYYY hh:mm<br>
<?php echo date('j/m/Y H:i'); ?></p>
</body>
</html>

Di PHP memang jauh lebih mudah dan sederhana karena sudah ada fungsi date().

Berikut beberapa parameter yang umum saya gunakan.

 

  • l   = Huruf L (huruf kecil) digunakan untuk menampilkan nama hari dalam bentuk huruf secara lengkap
  • D = Digunakan untuk menampilkan nama hari dalam bentuk huruf dengan jumlah tiga 3 digit karakter saja (Sun, Mon) dll
  • d = Digunakan untuk menampilkan tanggal, dengan bentuk angka dari mulai angka 01 – 31
  • M = Digunakan untuk menampilkan bulan dengan tampilan berupa huruf
  • m = Digunakan untuk menampilkan bulan dengan tampilan berupa angka
  • Y  = Digunakan untuk menampilkan tahun dalam bentuk angka dengan 4 digit.
  • y  = Digunakan untuk menampilkan tahun dengan dua angka terakhir dari tahun saat ini.

 

Untuk daftar lengkap parameter format tanggal/waktu bisa Anda lihat di php.net

Sumber Lain:

Rabu, 05 Mei 2021

EQUNIX-debian10

 

How to Install a Debian 10 (Buster) Minimal Server

This tutorial shows how to install a Debian 10 - Buster - minimal server in detail with many screenshots. The purpose of this guide is to provide a minimal setup that can be used as the basis for our other Debian 10 tutorials here at howtoforge.com.

1 Requirements

To install a Debian 10 server system you will need the following:

I will use the Debian 10.0 64Bit (amd64) installation media.

The Debian Download links change regularly. If the above links do not work anymore, then go here to fetch the latest Debian netinst image: https://www.debian.org/distrib/netinst or from https://cdimage.debian.org/mirror/cdimage/

2 Preliminary Note

In this tutorial, I will use the hostname server1.example.com with the IP address 192.168.0.100 and the gateway 192.168.0.1. These settings might differ for you, so you have to replace them where appropriate.

3 The Debian Base System

Insert your Debian 10 (Buster) network installation CD into your system (or a USB drive where you installed the iso file on) and boot from it. When you use virtualization software like VMware or Virtualbox, then select the Debian 10 minimal iso file as source file for the DVD drive of the VM, you don't have to burn it to a CD or DVD for that first.

Select Install (this will start the text installer - if you prefer a graphical installer, select Graphical install):

Debian 10 Boot Screen

Select your language:

Select Debian installation language

Then choose your location and select the keyboard layout. the next screens will differ depending on your choices. Just select which country and keyboard layout are the right ones for you as they define the language that your Debian system will use on the shell and which keyboard layout is used. In my case, I'll have a german keyboard layout but prefer English as the language on the shell.

Select Country, territory or area:

Select server location / country

Select your location, territory again and locale and keyboard:

Continent or region

select location

configure locale

select keymap

The installer checks the installation CD, your hardware and configures the network with DHCP if there is a DHCP server in the network:

Loading additional components

Configure network with DHCP

Enter hostname. In this example, my system is called server1.example.com, so I enter server1:

Enter the server hostname

Enter your domain name. In this example, this is example.com:Advertisement

Enter the domain name of the Debian server

Afterward, give the root user a password:

Enter the root password

Confirm that password to avoid typos:

Confirm the root password

Create a Linux user account, e.g. your name or nickname. For this example installation, I will choose the name "administrator" with the user name administrator (don't use the user name admin as it is a reserved name on Debian Linux):

Enter realname of the user

Enter username

Set a password

Repeat the user password

Now you have to partition your hard disk. For simplicity's sake, I select Guided - use entire disk - this will create a large partition for the / file system and another one for swap (of course, the partitioning is totally up to you - if you know what you're doing, you can also set up your partitions manually). For hosting systems like the ISPConfig 3 perfect server tutorials you might want to choose e.g. 60GB for / and a large /var partition as all website and email data is stored in subdirectories of /var.

Partition method

Select the disk that you want to partition:

Select Disk partition

Then select the partitioning scheme. As mentioned before, I select All files in one partition (recommended for new users) for simplicity's sake - it's up to your likings what you choose here:

Partition scheme

When you're finished, select Finish partitioning and write changes to disk:

Finish partitioning

Select Yes when you're asked: "Write changes to disk?":

Write partitions to disk

Afterward, your new partitions are created and formatted. Now the partitions are created and the base system is installed:

Creating Partitions

Installing the base system

It might be that the following screens pop's up, depending on your install media. I will do a network-based installation (all additional installation packages get downloaded from the internet), so I choose here to not scan any additional install disks.

Scan installation media

Next, you must configure apt. Because we are using the Debian Netinstall CD, which contains only a minimal set of packages, we must use a network mirror. Select the country where the network mirror that you want to use is located (usually this is the country where your Server system is located):

Configure apt country

Then select the mirror you wish to use (e.g. deb.debian.org):

Select Debian mirror

Unless you use an HTTP proxy, leave the following field empty and hit Continue:

Configure apt proxy

Apt is now updating its packages database:

apt downloads packages

You can skip the package usage survey by selecting No:

skip package survey

We just select Standard system utilities and SSH server (so that I can immediately connect to the system with an SSH client such as PuTTY after the installation has finished) and hit Continue.

Some might argue that one should not install the Standard System Utilities on a minimal server but in my opinion, you will need most of the standard utilities later anyway so I will install them on this server as part of the base setup.

software selection

The required packages are downloaded and installed on the system:

Select and install software

When you're asked to Install the GRUB boot loader to the master boot record?, select Yes:

Install GRUB in MBR

The installer might ask you in which partition Grub shall be installed. This server has just one hard disk, so I choose /dev/sda here.

Select device for boot loader installation

Press enter and the Installer will install Grub and finishes the installation.

Installing GRUB boot loader and finishing the installation

The base system installation is now finished. Remove the Debian Netinstall CD from the CD drive and hit Continue to reboot the system:

Installation complete

The first boot of the newly installed Debian 10 server: first you will see the boot screen of the Grub Boot Loader, press enter or wait a few seconds, the boot process will continue automatically.

Booting Debian 10

A few seconds later the login prompt should show up.

Debian 10 (Buster) server first boot

Login with username "root" and the root password that you have chosen during installation. When you log in by SSH, then use the username "administrator" as the root user is disabled for remote logins. Then run the command "su":

su

To become root user.

On to the next step...

4 Install The SSH Server (Optional)

If you did not install the OpenSSH server during the system installation, you could do it now:

apt-get -y install ssh openssh-server

From now on you can use an SSH client such as PuTTY and connect from your workstation to your Debian Jessie server and follow the remaining steps from this tutorial.

5 Install a shell editor (Optional)

I'll use nano as my favorite shell text editor, others prefer vi that is not that easy to use for beginners. With the following command I will install both editors:

apt-get -y install vim-nox nano

(You don't have to do this if you use a different text editor such as joe or the built-in editor from mc).

6 Configure The Network

You can get your current IP address with the command:

ip a

By default, some network tools are not available. Install the package with:

apt-get install net-tools

Because the Debian 10 installer has configured our system to get its network settings via DHCP, we have to change that now because a server should have a static IP address. Edit /etc/network/interfaces and adjust it to your needs (in this example setup I will use the IP address 192.168.0.100) (please note that I replace allow-hotplug ens33 with auto ens33; otherwise restarting the network doesn't work, and we'd have to reboot the whole system):

nano /etc/network/interfaces

The interfaces file with DHCP enabled as created by the apt installer:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug ens33
iface ens33 inet dhcp
# This is an autoconfigured IPv6 interface
iface ens33 inet6 auto

And here the edited interfaces file with the static IP 192.168.0.100 configured.

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/* # The loopback network interface auto lo iface lo inet loopback # The primary network interface auto ens33 iface ens33 inet static address 192.168.0.100 netmask 255.255.255.0 network 192.168.0.0 broadcast 192.168.0.255 gateway 192.168.0.1

# This is an autoconfigured IPv6 interface
iface ens33 inet6 auto

Then restart your network:

systemctl restart networking

Then edit /etc/hosts. Make it look like this:

nano /etc/hosts
127.0.0.1       localhost.localdomain   localhost
192.168.0.100   server1.example.com     server1

# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

Now edit the hostname in case you did not select the final hostname in the installer

nano /etc/hostname

The /etc/hostname file contains the hostname without the domain part, so in our case just "server1".

Then reboot the server to apply the hostname change:

systemctl reboot

After you logged in again, run:

hostname
hostname -f

To verify that the new hostname is set correctly. The output should be:

root@server1:/home/administrator# hostname
server1
root@server1:/home/administrator# hostname -f
server1.example.com
root@server1:/home/administrator#

7 Update Your Debian Installation

First, make sure that your /etc/apt/sources.list contains the buster/updates repository (this makes sure you always get the newest updates), and that the contrib and non-free repositories are enabled.

nano /etc/apt/sources.list
deb http://deb.debian.org/debian/ buster main contrib non-free
deb-src http://deb.debian.org/debian/ buster main contrib non-free

deb http://security.debian.org/debian-security buster/updates main contrib non-free
deb-src http://security.debian.org/debian-security buster/updates main contrib non-free

Run

apt-get update

to update the apt package database and

apt-get upgrade

to install the latest updates (if there are any).

8 Debian 10 VMWare server image

This tutorial is available as ready to use virtual machine image in ovf/ova format that is compatible with VMWare and Virtualbox. The virtual machine image uses the following login details:

SSH / Shell Login

Username: administrator
Password: howtoforge

Username: root
Password: howtoforge

The IP of the VM is 192.168.0.100, it can be changed in the file /etc/network/interfaces. Please change all the above passwords to secure the virtual machine.

Minggu, 02 Mei 2021

WIND2003-exspire

 

https://www.youtube.com/watch?v=r59hyypzPG8

Cara bypass aktifasi yang terlewat pada windows XP

Disini saya akan share pengalaman saya saat lupa meng-aktifasi windows XP pada komputer kantor. Mungkin ada teman-teman yang pernah mengalami juga? Daripada kita install ulang windows Xp karena tidak bisa login seperti ini:

Tidak bisa login
Lebih baik kita akalin saja ehehehe....
Ok berikut langkah-langkahnya yang saya rangkum dari Mbah google.
  • Restart PC atau lapy pada safemode (biasanya tekan key F8 saat booting) dan pilih safemode with CMD
Safemode
  • Lalu login dengan akun administrator. Bila login meminta password masukan password. (tapi biasanya pengguna harian seperti saya :) tidak membuat password administrator)
Login administrator
  • Maka akan tampil seperti ini:
CMD pada safemode
Lalu ketikan perintah berikut:
"rundll32.exe syssetup,SetupOobeBnk"  tanpa tanda kutip! Kemudian ENTER
(pengetikan perintah adalah case sensitive, Oo setelah Setup adalah huruf bukan angka, saya sempat terkecoh karena tidak memperhatikan, saya kira angka maka perintah selalu error..hehehe...)
Microsoft Windows Version 5
Copyright (c) Microsoft Corporation.  All rights reserved.

C:\WINDOWS>rundll32.exe syssetup,SetupOobeBnk

C:\WINDOWS>
Jika tidak ada error berarti perintah tersebut berhasil. Restart PC atau lapy Anda.

  • Jika berhasil maka akan tampil seperti saat pertama kali kita install ulang windows XP, seperti pada contoh gambar berikut:
Tampilan aktifasi pertama
Dan masa aktifasi kembali menjadi 30 hari :)
Jangan lupa segera aktifasi windows XP Anda yach.... Tentu windows yang original :)

Semoga bermanfaat yach....