Sponsored Content
Top Forums Shell Programming and Scripting Need help to create a date script Post 302093490 by ghostdog74 on Thursday 19th of October 2006 08:07:44 PM
Old 10-19-2006
Python alternative
Code:
import sys,time
day,month,year = sys.argv[1:] #assume first param is day, then month, finally year
b = time.strptime("%s %s %s" % (day ,month, year), "%d %m %Y")
convert = time.strftime("%A", b)
print convert

output:
Code:
/home> python test.py 19 10 2006
Thursday

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Directory create date

Hi, How do you find the create date of a directory? I can see the modification date using ls -l but I'm looking for the create date. Many thanks Helen (2 Replies)
Discussion started by: Bab00shka
2 Replies

2. Shell Programming and Scripting

need to create a file with its name having system date

Hi, Iam new to unix . I need to write a scritp which can create a file having sysdate as a part of it.and i also need to delete file which is created five days before in a directory.pls Help me out thanks in advance (11 Replies)
Discussion started by: hamsa
11 Replies

3. Shell Programming and Scripting

Create a script using DATE command?

Not even sure how to word this. Basically, we have a log file that gathers all alerts for a system. What I am doing is grepping through this file and grabbing certain strings that are outputted to a file, then mailed to a group. Here is the catch. Since I cannot copy this file to a temp file... (1 Reply)
Discussion started by: thecoffeeguy
1 Replies

4. UNIX for Dummies Questions & Answers

Find and Create by Date

I have a log file that's generated on a daily basis, and saved with the Month and day at the end of it. For instance: file_type_Aug17.csv. As part of my excel conversion I need my script to search for the current Month and day(Aug17) and convert it. Thanks for your help! (14 Replies)
Discussion started by: ravzter
14 Replies

5. Homework & Coursework Questions

Create script to add user and create directory

first off let me introduce myself. My name is Eric and I am new to linux, I am taking an advanced linux administration class and we are tasked with creating a script to add new users that anyone can run, has to check for the existence of a directory. if the directory does not exist then it has... (12 Replies)
Discussion started by: pbhound
12 Replies

6. Shell Programming and Scripting

help to create script for added date to list users

hi my friends im asking for the possibility to creat a script in ubuntu for added date to list users for doing this : - search in debug connected user of all connected users - if a new user is connect for the first time to my server the script record the date of the connection and added it... (1 Reply)
Discussion started by: amzioujda
1 Replies

7. Shell Programming and Scripting

How to create variable from date

I have a requirement to send a trigger file (trigger_dayn.dat) to a remote server through the FTP trigger_dayn.dat - here the dayn is the day number. However the dayn is not sysdate. day 1 is from Monday 07:00.00 AM to Tuesday 06:59:59 AM and so on. So if the trigger file is generated say... (1 Reply)
Discussion started by: k_vikash
1 Replies

8. Shell Programming and Scripting

Create a Date Check Script

I have about 100 Linux servers running in Amazon EC2 (CentOS 6 based) and I need to run a 'date' command against all of them. Rather than logging into each individual server via 'ssh' and running the 'date' command, can someone please help me with how something like this can be scripted? I... (6 Replies)
Discussion started by: cmennens
6 Replies

9. Shell Programming and Scripting

Please help, need to create script to remove lines by date in file

Please Help (novice to PERL and SHELL scripting)…. Need to create a script which removes all lines in $filename = "cycle_calendar_ftp_out" older than current date – a variable which will be a number of days passed to script. For Ex it will look at the end date which is the last field (4) and... (2 Replies)
Discussion started by: m3pwr
2 Replies

10. Shell Programming and Scripting

Replacing Date in the file with Create date and timestamp

Hello, I have files that with a naming convention as shown below. Some of the files have dates in the file name and some of them don't have dates in the file name. imap-hp-import-20150917.txt imap-dell-gec-import-20150901.txt imap-cvs-import-20150915.txt imap-gec-import.txt... (8 Replies)
Discussion started by: Saanvi1
8 Replies
DATETIME.SETISODATE(3)							 1						    DATETIME.SETISODATE(3)

DateTime::setISODate - Sets the ISO date

       Object oriented style

SYNOPSIS
public DateTime DateTime::setISODate (int $year, int $week, [int $day = 1]) DESCRIPTION
Procedural style DateTime date_isodate_set (DateTime $object, int $year, int $week, [int $day = 1]) Set a date according to the ISO 8601 standard - using weeks and day offsets rather than specific dates. PARAMETERS
o $object -Procedural style only: A DateTime object returned by date_create(3). The function modifies this object. o $year - Year of the date. o $week - Week of the date. o $day - Offset from the first day of the week. RETURN VALUES
Returns the DateTime object for method chaining or FALSE on failure. CHANGELOG
+--------+---------------------------------------------------+ |Version | | | | | | | Description | | | | +--------+---------------------------------------------------+ | 5.3.0 | | | | | | | Changed the return value on success from NULL to | | | DateTime. | | | | +--------+---------------------------------------------------+ EXAMPLES
Example #1 DateTime.setISODate(3) example Object oriented style <?php $date = new DateTime(); $date->setISODate(2008, 2); echo $date->format('Y-m-d') . " "; $date->setISODate(2008, 2, 7); echo $date->format('Y-m-d') . " "; ?> Procedural style <?php $date = date_create(); date_isodate_set($date, 2008, 2); echo date_format($date, 'Y-m-d') . " "; date_isodate_set($date, 2008, 2, 7); echo date_format($date, 'Y-m-d') . " "; ?> The above examples will output: 2008-01-07 2008-01-13 Example #2 Values exceeding ranges are added to their parent values <?php $date = new DateTime(); $date->setISODate(2008, 2, 7); echo $date->format('Y-m-d') . " "; $date->setISODate(2008, 2, 8); echo $date->format('Y-m-d') . " "; $date->setISODate(2008, 53, 7); echo $date->format('Y-m-d') . " "; ?> The above example will output: 2008-01-13 2008-01-14 2009-01-04 Example #3 Finding the month a week is in <?php $date = new DateTime(); $date->setISODate(2008, 14); echo $date->format('n'); ?> The above examples will output: 3 SEE ALSO
DateTime.setDate(3), DateTime.setTime(3). PHP Documentation Group DATETIME.SETISODATE(3)
All times are GMT -4. The time now is 11:55 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy