'DateTime'에 해당되는 글 4건
- 2008/10/27 Put Date Time on HTML
- 2008/03/12 How to rename(change file name) in C# ?
- 2007/08/31 How to get date time in Javascript ?
- 2007/08/31 Basic Date Display
In JSP, you can simply put Date Time as below.
Here's the simple example change file name for Samsung Black Jack Phone. However it may work on another platform if it supports .NET compact framework.
In addition, File creation time can be obtained by FileInfo class. See the below example for addition example.
//
// Programmed 2008 by Kurapa Chunun Kang (kurapa@kurapa.com)
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO; // added for FileInfo class
namespace fnc
{
class Program
{
// developed for Samsung Black Jack Smart Phone
static void KChangeFileNameFoBlackJack(string strDir)
{
int iocnt = 100;
DirectoryInfo dir = new DirectoryInfo( strDir);
FileInfo[] bmpfiles = dir.GetFiles("PIC-*.jpg");
Console.WriteLine("Total number of bmp files", bmpfiles.Length);
foreach (FileInfo f in bmpfiles)
{
String fn = fCreationTime.Year + "-"
+ ((f.CreationTime.Month<10) ? "0":"") + f.CreationTime.Month + "-"
+ ((f.CreationTime.Day < 10) ? "0" : "") + f.CreationTime.Day + "_"
+ ((f.CreationTime.Hour < 10) ? "0" : "") + f.CreationTime.Hour
+ ((f.CreationTime.Minute < 10) ? "0" : "") + f.CreationTime.Minute
+ ((f.CreationTime.Second < 10) ? "0" : "") + f.CreationTime.Second
+ (iocnt++)
+ ".jpg";
File.Move( strDir + "\\" + f.Name, strDir + "\\" + fn);
}
}
static void Main(string[] args)
{
KChangeFileNameForBlackJack(@"\Storage Card\My Pictures");
}
}
}
// Programmed 2008 by Kurapa Chunun Kang (kurapa@kurapa.com)
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO; // added for FileInfo class
namespace fnc
{
class Program
{
// developed for Samsung Black Jack Smart Phone
static void KChangeFileNameFoBlackJack(string strDir)
{
int iocnt = 100;
DirectoryInfo dir = new DirectoryInfo( strDir);
FileInfo[] bmpfiles = dir.GetFiles("PIC-*.jpg");
Console.WriteLine("Total number of bmp files", bmpfiles.Length);
foreach (FileInfo f in bmpfiles)
{
String fn = fCreationTime.Year + "-"
+ ((f.CreationTime.Month<10) ? "0":"") + f.CreationTime.Month + "-"
+ ((f.CreationTime.Day < 10) ? "0" : "") + f.CreationTime.Day + "_"
+ ((f.CreationTime.Hour < 10) ? "0" : "") + f.CreationTime.Hour
+ ((f.CreationTime.Minute < 10) ? "0" : "") + f.CreationTime.Minute
+ ((f.CreationTime.Second < 10) ? "0" : "") + f.CreationTime.Second
+ (iocnt++)
+ ".jpg";
File.Move( strDir + "\\" + f.Name, strDir + "\\" + fn);
}
}
static void Main(string[] args)
{
KChangeFileNameForBlackJack(@"\Storage Card\My Pictures");
}
}
}
<script language="javascript">
<!-- Hide script from old browsers --
function today()
{
mydate = newDate();
myday = mydategetDay();
mymonth = mydategetMonth();
myweekday= mydategetDate();
weekday= myweekday;
if(myday == 0)
day = "Sunday,"
else if(myday == 1)
day = "Monday,"
else if(myday == 2)
day = "Tuesday,"
else if(myday == 3)
day = "Wednesday,"
else if(myday == 4)
day = "Thursday,"
else if(myday == 5)
day = "Friday,"
else if(myday == 6)
day = "Saturday, "
if(mymonth == 0)
month = "January"
else if(mymonth ==1)
month = "February"
else if(mymonth ==2)
month = "March"
else if(mymonth ==3)
month = "April"
else if(mymonth ==4)
month = "May"
else if(mymonth ==5)
month = "June"
else if(mymonth ==6)
month = "July"
else if(mymonth ==7)
month = "August"
else if(mymonth ==8)
month = "September"
else if(mymonth ==9)
month = "October"
else if(mymonth ==10)
month = "November"
else if(mymonth ==11)
month = "December"
daydate = weekday
document.write("<font size=2>"+"<b>"+day+"</b>"+" " );
document.write("<b>"+month+" "+daydate+","+" 2000"+"</b>"+"</font>");
}
// -- End Hiding Here -->
</script>
<p> <script language="javascript">today()</script></p>
<!-- Hide script from old browsers --
function today()
{
mydate = newDate();
myday = mydategetDay();
mymonth = mydategetMonth();
myweekday= mydategetDate();
weekday= myweekday;
if(myday == 0)
day = "Sunday,"
else if(myday == 1)
day = "Monday,"
else if(myday == 2)
day = "Tuesday,"
else if(myday == 3)
day = "Wednesday,"
else if(myday == 4)
day = "Thursday,"
else if(myday == 5)
day = "Friday,"
else if(myday == 6)
day = "Saturday, "
if(mymonth == 0)
month = "January"
else if(mymonth ==1)
month = "February"
else if(mymonth ==2)
month = "March"
else if(mymonth ==3)
month = "April"
else if(mymonth ==4)
month = "May"
else if(mymonth ==5)
month = "June"
else if(mymonth ==6)
month = "July"
else if(mymonth ==7)
month = "August"
else if(mymonth ==8)
month = "September"
else if(mymonth ==9)
month = "October"
else if(mymonth ==10)
month = "November"
else if(mymonth ==11)
month = "December"
daydate = weekday
document.write("<font size=2>"+"<b>"+day+"</b>"+" " );
document.write("<b>"+month+" "+daydate+","+" 2000"+"</b>"+"</font>");
}
// -- End Hiding Here -->
</script>
<p> <script language="javascript">today()</script></p>
<!-- ONE STEP TO INSTALL BASIC DATE DISPLAY:
1. Copy the coding into the BODY of your HTML document -->
<!-- STEP ONE: Paste this code into the BODY of your HTML document -->
<BODY>
<SCRIPT LANGUAGE="JavaScript">
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- Author: www.cgiscript.net -->
<!-- Begin
// Get today's current date.
var now = newDate();
// Array list of days.
var days = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
// Array list of months.
var months = new Array('January','February','March','April','May','June','July','August','September','October','November','December');
// Calculate the number of the current day in the week.
var date = ((now.getDate()<10) ? "0" : "") now.getDate();
// Calculate four digit year.
function fourdigits(number) {
return (number < 1000) ? number 1900 : number;
}
// Join it all together
today = days[now.getDay()] ","
months[now.getMonth()] " "
date ","
(fourdigits(now.getYear())) ;
// Print out the data.
document.write(today);
// End -->
</script>
<p><center>
<font face="arial,helvetica" size"-2">Free JavaScripts provided<br>
by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
</center><p>
<!-- Script Size: 1.30 KB -->
1. Copy the coding into the BODY of your HTML document -->
<!-- STEP ONE: Paste this code into the BODY of your HTML document -->
<BODY>
<SCRIPT LANGUAGE="JavaScript">
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- Author: www.cgiscript.net -->
<!-- Begin
// Get today's current date.
var now = newDate();
// Array list of days.
var days = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
// Array list of months.
var months = new Array('January','February','March','April','May','June','July','August','September','October','November','December');
// Calculate the number of the current day in the week.
var date = ((now.getDate()<10) ? "0" : "") now.getDate();
// Calculate four digit year.
function fourdigits(number) {
return (number < 1000) ? number 1900 : number;
}
// Join it all together
today = days[now.getDay()] ","
months[now.getMonth()] " "
date ","
(fourdigits(now.getYear())) ;
// Print out the data.
document.write(today);
// End -->
</script>
<p><center>
<font face="arial,helvetica" size"-2">Free JavaScripts provided<br>
by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
</center><p>
<!-- Script Size: 1.30 KB -->


fnc.zip
Prev

Rss Feed