Solved

format date

Posted on 2000-05-11
2
207 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
[X]
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
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…

730 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