How to save file as "current date-current time"
Hello,
I'm trying to rename a file as from file.mov to "current date-current time"movie.mov, So the final product should be something along the lines of 08-18-08-12:59:08movie.mov (or whatever format the current date/time is in osx). Any ideas on how I would go about this? Thanks again!
Hello Vb,
This script *shows the created date of a file*. Maybe you can do something with it. With a small change it get the date from the finder add adds it to the file.
set selectedFile to (choose file)
tell application "Finder"
set modDate to the modification date of selectedFile
end tell
display dialog "That file was last modified on: " & modDate
This scripts shows *how long ago the file was created*:
--Part 1:
set selectedFile to (choose file)
tell application "Finder"
set modDate to the modification date of selectedFile
--Part 2:
set curDate to the current date
--Part 3:
if (the year of modDate) ≠ (the year of curDate) then
set ageInYears to (the year of curDate) - (the year of modDate)
display dialog "The file was changed " & ageInYears & " years ago."
--Part 4:
else
if (the month of modDate) ≠ (the month of curDate) then
set ageInMonths to (the month of curDate) - (the month of modDate)
display dialog "The file was changed " & ageInMonths & "months ago."
--Part 5
else
if (the day of modDate) ≠ (the day of curDate) then
set ageInDays to (the day of curDate) - (the day of modDate)
display dialog "The file is " & ageInDays & "days old."
else
display dialog "The file was changed today."
end if
end if
end if
end tell
Similar Messages
-
How to get the most current file based on date and time stamp using SSIS?
Hello,
Let us assume that files get copied in a specific directory. We need to pick up a file and load data. Can you guys let me know how to get the most current file based on date and time stamp using SSIS?
Thanks
thx regards dinesh vvhi simon
i excuted this script it is giving error..
Microsoft SQL Server Integration Services Script Task
Write scripts using Microsoft Visual C# 2008.
The ScriptMain is the entry point class of the script.
using System;
using System.Data;
using Microsoft.SqlServer.Dts.Runtime;
using System.Windows.Forms;
namespace ST_9a6d985a04b249c2addd766b58fee890.csproj
[System.AddIn.AddIn("ScriptMain", Version = "1.0", Publisher = "", Description = "")]
public partial class ScriptMain : Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase
#region VSTA generated code
enum ScriptResults
Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success,
Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure
#endregion
The execution engine calls this method when the task executes.
To access the object model, use the Dts property. Connections, variables, events,
and logging features are available as members of the Dts property as shown in the following examples.
To reference a variable, call Dts.Variables["MyCaseSensitiveVariableName"].Value;
To post a log entry, call Dts.Log("This is my log text", 999, null);
To fire an event, call Dts.Events.FireInformation(99, "test", "hit the help message", "", 0, true);
To use the connections collection use something like the following:
ConnectionManager cm = Dts.Connections.Add("OLEDB");
cm.ConnectionString = "Data Source=localhost;Initial Catalog=AdventureWorks;Provider=SQLNCLI10;Integrated Security=SSPI;Auto Translate=False;";
Before returning from this method, set the value of Dts.TaskResult to indicate success or failure.
To open Help, press F1.
public void Main()
string file = Dts.Variables["User::FolderName"].Value.ToString();
string[] files = System.IO.Directory.GetFiles(Dts.Variables["User::FolderName"].Value.ToString());
System.IO.FileInfo finf;
DateTime currentDate = new DateTime();
string lastFile = string.Empty;
foreach (string f in files)
finf = new System.IO.FileInfo(f);
if (finf.CreationTime >= currentDate)
currentDate = finf.CreationTime;
lastFile = f;
Dts.Variables["User::LastFile"].Value = lastFile;
Dts.TaskResult = (int)ScriptResults.Success;
thx regards dinesh vv -
How to create a Date or time field that automatically saves current date or time?
hello,
i want to know that how to create a Date/Time field that automatically shows current Date/Time when .pdf form is opened.
also want to how to stop user to give input in Date/Time field
currently im putting a Date field but it is accepting user input.
hoping for quick response
Thanks in advance!You can place the below code in the initialize event of the field to display the current date and time.
Set the language to FormCalc.
You can play around the formats to get the desired format of date and time.
if($.rawValue eq null or $.rawValue eq "") then
$.rawValue = Concat(Num2Date(Date(), "MM/DD/YYYY")," ", Num2Time(Time(), "h:MM:SS A"));
endif
You can not restrict the input area in Date time field instead you can validate the input while existing the field.
(OR) set the field to either readOnly or protected mode.
Thanks
Srini -
Help adding current Date and Time stamp to file name
I need help with my script adding current Date and Time stamp to file name.
This is my file name = myfile.htm
I would like to save it as = myfile.htm 8/29/2007 11:41 AM
This is my script:
<script>
function doSaveAs(){
if (document.execCommand){
document.execCommand('SaveAs','1','myfile.htm')
else {
alert("Save-feature available only in Internet Exlorer 5.x.")
</script>
<form>
<input type="button" value="Click here to Save this page for your record" onClick="doSaveAs()"
</form>
Thank youI agree, I guess I overlooked that!
I would like to save it as = myfile 8/29/2007 11:41 AM .htm
I need help with my script adding current Date and Time stamp to file name.
This is my file name = myfile.htm
I would like to save it as = myfile 8/29/2007 11:41 AM .htm
This is my script:
<script>
function doSaveAs(){
if (document.execCommand){
document.execCommand('SaveAs','1','myfile.htm')
else {
alert("Save-feature available only in Internet Exlorer 5.x.")
</script>
<form>
<input type="button" value="Click here to Save this page for your record" onClick="doSaveAs()"
</form> -
How to view current date and time on SAP screen
Hi Everybody,
How to view current date and time on SAP screen .I have set time zone in T-code STZAC.now iam getting correct date n time in my tranctions but i want to check without any tractions
Plz repay,Regards,
Sadik.Hi,
You can check the time by running a report .
It will show the database and central instance time : Report name :rsdbtime
Thanks and Regards
Vijay kumar G
Edited by: vijay kumar gopal on Mar 4, 2008 1:09 PM -
How to get the current data and time of SCOM server via SCOM SDK (API) calls?
Hi,
I need to read the current date and time of SCOM server via SOM SDK.
Is there a class in SDK that provides this info ?
Thanks,
satheeshTo get time and date of Alerts of SCOM, You can use following command let "get-scomalert"
Also, You can refer below links
http://blog.tyang.org/2013/02/21/using-scom-2012-sdk-to-retrieve-resource-pools-information/
Please remember, if you see a post that helped you please click "Vote As Helpful" and if it answered your question, please click "Mark As Answer"
Mai Ali | My blog: Technical -
How to display the current Date and time in xslt version 1
i am using xslt version 1 .i want to display the current date and time in the output xml using xslt(Jdeveloper) ..i just added the namespace xmlns:xp20="http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.Xpath20"
xmlns:ns1="urn:oracle:integration:b2b:7D30046DC68A4FA689956D8241FA3B99">
and used thsi function <xsl:value-of select = "xp20:current-date()"/>
but it does not works for me ..help needed????
Edited by: user9519185 on Jan 20, 2009 3:04 AMUse a formula: =NOW()
Format the cell for Date and Time, with both the Date part and the Time part displayed. Format the two parts as you wish, using the choices in the Inspector's menus.
The cell will update each time the table is recalculated.
(Description is for Numbers '09 (Mac), Numbers for iOS will be similar, but not necessarly identical in details.)
Regards,
Barry -
I am working on an application which needs to store different versions of files and should assign them names as docId_year.month.day.hours.mins.sec
How should I get current date n time and can I convert it to a string using toString Method?
ThanksExample:Date date = new Date();
SimpleDateFormat df = new SimpleDateFormat("yyyyMMdd_");
String prefix = df.format(date);
System.out.println(prefix); // 20040425_ -
Odd Date for Current Date and Time
I am modifying a column in a list to get current date and time using =TODAY()+NOW() in the calculated field and get a time that is behind by 1 hour but the date is 4 months 114 years ahead (2128). How can I fix this field?
http://sharepointsolutions.com/sharepoint-help/blog/2011/04/how-to-add-and-subtract-hours-and-minutes-from-date-and-time-fields-in-sharepoint-lists/
-
Current Date and Time in JLabel
Hi i am fairly new to Java and i would like to know how i can get a label to show the current date and time ( with seconds) to show up in the top right hand corner.
Thank you.Hi i am fairly new to Java and i would like to know
how i can get a label to show the current date and
time ( with seconds) to show up in the top right hand
corner.
Thank you.You can use TimerTask to do it. also go through the api for Calendar, Date and DateFormat. -
Wrote the current Date and Time in the backend
HI everyone,
I created a table view, where I display several records. Right now I will add an record to this table, which should be written back in the backend and automaticaly add the current date and time.
But I don´t know to make this. I tried several time with the funktion "now()", but it doesn´t work. So any help for me, to explain how I can display the actual time and then write it back to the backend?
Thankswe use a crm system. but the BAPI I mentioned was
just to play with. My basis will develop a new API
for the project, that have the requested Inputfields.
But what I tottaly forget was, that there has to be a
field for the time, so thanks for the advice.
No Problem.
I´m still of the opinion , that it should be possible
to add the curret time in a field with the
funcionality of the VC, even there is a way to show a
clock with the current time. My problem is that I
can´t figuer out how to do this.
Therefore you can use the TNow() function (Time functions) and the Now() Function (Date functions). You can cast them to a string and concatenate the string, then you have the date of today with the current time. This string you can format and transfer it as input for your BAPI_ADD_BP for example.
Hope that helps.
Best Regards,
Marcel -
Put the current date and time in a string
I am having trouble trying to put the current date and time from my Calendar object into a string
any ideas?Calendar timeCal = Calendar.getInstance();
timeCal.setTime(new Date(System.currentTimeMillis() - startTime ));
String date = formatToTwoDigits(timeCal.get(Calendar.HOUR_OF_DAY)) + ":" +
formatToTwoDigits(timeCal.get(Calendar.MINUTE)) + ":" +
formatToTwoDigits(timeCal.get(Calendar.SECOND));
private String formatToTwoDigits(int i) {
String ret = null;
i = i % 100;
if (i < 10) {
ret = "0" + Integer.toString(i);
} else {
ret = Integer.toString(i);
return ret;
You can figure out yourselve how to display the date, use other Calendar.XXX properties.
Good luck! -
I'm trying to display the current date and time on my iPad.
First, I'm not sure this is a valid post to this forum. If not, I'd appreciate knowg in where I can get help.
I have tried several ways to display the current date and time on my iPad. None work. Most things I try give me complier errors but the latest code compiles but won't display the correct time.
Here's the dispatch code in my ViewController.m file:
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0ul);
dispatch_async(queue, ^{
[NSTimer scheduledTimerWithTimeInterval:NSTimeInterval)1.0f target:self selector:@selector(updateLabel:) userInfo:nil repeats:YES];
Here's the updateLabel code: (which never gets executed).
- (void)updateLabel:(id) sender {
dispatch_sync(dispatch_get_main_queue(), ^{
NSLog(@"Datefield Update Called");
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"EEEE, MMMM dd, yyyy 'at' HH:mm ZZZZ"];
NSDate *dayTime = [NSDate date];
NSString *formattedDateString = [dateFormatter stringFromDate:dayTime];
_dateField.text = formattedDateString;
[self.view addSubview:_dateField];
NSLog(@"Datefield %@",_dateField.text);Your code is needlessly complicated and has a few problems:
// These objects should be created only once.
NSTimer *dateAndTimeTimer; (You might need to make this a property with a strong reference).
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc]init];
[dateFormatter setDateFormat:@"EEEE, MMMMM dd, yyyy 'at' HH:mm ZZZZ"];
// The subview should only be added once.
[self.view addSubview:_dateField];
[self performSelectorOnMainThread:@selector(startDateAndTimeTimer)
withObject:nil
waitUntilDone:YES];
-(void)startDateAndTimeTimer
NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:1
target:self
selector:@selector(updateLabel)
userInfo:nil
repeats:YES];
dateAndTimeTimer = timer;
[[NSRunLoop mainRunLoop] addTimer:dateAndTimeTimer forMode:NSRunLoopCommonModes];
-(void)updateLabel
NSDate *dateTime = [NSDate date];
NSString *formattedDataString = [dateFormatter stringFromDate:dateTime];
_dateField.text = formattedDateString;
NSLog(@"_dateField.text=%@", _dateField.text); -
hello.
How can I get current date and time in JAVA?
Thanks.Sorry, I mean:
how can I get the value of DATE, MONTH, and YEAR of the
current date?
Date date = new Date();
System.out.println(date); -
Displaying Current Date and Time in JSP
Hi,
I need to insert the current date time in Ms SQL Server Database using jsp page. The format of the code willbe
insert into table(update_date) values ('2007-01-01 10:02:21');
But i am not getting how to display the current date and time ie. 2007-01-01 10:02:21 using jsp.
I have tried using
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
GregorianCalendar cal = new GregorianCalendar();
String dd = sdf.format(cal.getTime());
insert into table(update_date) values (dd);
But it didnot get inserted data.
Can anybody figure out with simple ideas.
Thank YouWhy then are you trying to insert the current date on a table?
To show the current date on the JSP you might try
<%=new Date()%>Or the way you had it on your first post with the date formatter and then use the <%=%> tags. Anyway, it seems to me I'm not really understanding what you actually want to do :-p
P.S. NOW() is a MySQL function too, not only MSSQL server (didn't even know it had it too ;-))
mysql> insert into a(up) values (now());
Query OK, 1 row affected (0.00 sec)
mysql> select * from a;
+------------+
| up |
+------------+
| 2007-04-09 |
+------------+Message was edited by:
benubach
Message was edited by:
benubach
Maybe you are looking for
-
Activation error while changing the data type of a field of a table
hi friends, i am facing one problem while changing a data type of a field of a table. i just created one table(Yqm32) .i have assigned charcter data type to one field(ztotal_count) .now i want to change this charcter data type to numeric data type.
-
I want to install Windows 7 on my band new Macbook Pro 13 inch and use Parallel Desktop 6 torun it alongside my Mac OS. Do I need to buy a specific Mac version of Windows 7 or do I install a standard Windows 7 OS on the Mac using boot camp.
-
How do I resize a photo in iPhoto to downsize it
If I can downsize the photos in iPhoto, then I can save a batch of them on the FlashDrive. I don't see a method for downsizing or resizing them.
-
HI, first of all: I'm relatively new to LabWindows, working on it during some practical work as a Student (yeah, and sorry for the bad english, I'm from Germany) To the Problem: The first important Information: After having searched for a solution, I
-
External screen rotation broken?
Hi all, I've got a unibody macbook (first generation) with the Nvidia Geforce 9400M GPU. When I installed Snow Leopard in the place of Leopard, screen rotation stopped working for me. I have a mini-displayport to dual-link dvi adapter connected to ma