Solved

format date

Posted on 2000-05-11
2
204 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
two-way Authentication ASP 3 80
Saving more than one value from multiple drop down menu 14 50
Select2 jquery help 9 74
Recordset containing single quotes 8 21
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

911 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now