Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

format date

Posted on 2000-05-11
2
206 Views
Last Modified: 2006-11-17
how do i format a date variable so that it only displays hh:mm AM/PM?  I found a formatDateTime function but it only provides 5 different formats, none of which fit the format that I would like.

thanks
0
Comment
Question by:ueihp
2 Comments
 
LVL 6

Accepted Solution

by:
setiawan earned 50 total points
ID: 2802818
Hi ueihp,

you can use datepart function and create your own format
here is some desc & examples:

Setting  Deskripsi
 yyyy      year
 q         quarter
 m         month
 y         day of year
 d         day
 w         weekday
 ww        week of year
 h         hour
 n         minute
 s         second

<%
' Function ini berguna untuk menampilkan
' nama bulan dalam bahasa Indonesia
function TampilBulan(b)
  bulan = array("Januari","Februari", "Maret", "April", _
    "Mei", "Juni", "Juli", "Agustus", "September", _
    "Oktober", "November", "Desember")
  TampilBulan = bulan(b)
end function

' Function ini berguna untuk menampilkan
' nama hari dalam bahasa Indonesia
function TampilHari(c)
  hari = array("Minggu", "Senin","Selasa","Rabu","Kamis",_
    "Jumat","Sabtu")
  TampilHari = hari(c)
end function

function FormatTanggal(tgl)
  s = TampilHari(DatePart("w",tgl)-1)
  s = s & " " &  DatePart("d", tgl)
  s = s & " " & TampilBulan(DatePart("m", tgl)-1)
  s = s & " " & DatePart("yyyy", tgl)
  FormatTanggal = s
end function
%>

<html>
<head>
<title>Tampilkan hari ini</title>
</head>

<body>
  <H4><%= FormatTanggal(now())%></H4>
</body>
</html>

   
  danny
0
 
LVL 7

Expert Comment

by:weesiong
ID: 2802865
<%
response.write(Time)
%>
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

790 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question