?
Solved

format date

Posted on 2000-05-11
2
Medium Priority
?
210 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 150 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

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…
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/…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

764 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