Code Monkey home page Code Monkey logo

persiandateproject's Introduction

Persian Calendar Project in SQL Server

In this project, there are two tables:

1- DimDate table, which represents the calendar and stores Persian, Gregorian, and even Hijri dates along with various properties such as holidays, weekdays, seasons, week number, and day of the year.

2- DimDateDiff table, which includes two columns for the start date and end date, and other columns show the time difference between these two dates. One column represents the difference in days, and the other represents the difference in time, considering the Persian year and month in the format yyyy/MM/dd. For example, 0004/02/16 means there is a Persian time difference of 4 years, 2 months, and 16 days between the two dates.

Procedures:

1- FillDimDate: This procedure generates records for the calendar table based on the specified start and end date parameters. If the start parameter is not specified, it will generate records starting from 5 years ago until the end date. If it's not the first execution, it identifies the maximum date from the calendar table and starts inserting records from that date. The initial execution can be called as follows: Exec [Dbo].[FillDimDate] @FromDate = NULL, @UntilDate = '2025-01-01'

2- FillDimDateDiff: This procedure fills the time differences between the existing dates in the calendar table. It doesn't have any parameters and works based on the new data in the calendar table.

Functions:

1- PersianDateAdd: This function is the equivalent of the DateAdd function in SQL Server, but it operates based on the Persian calendar concepts.

2- PersianDateDiff: This function calculates the time difference between two Persian dates and returns the output in the format yyyy/MM/dd

These components together provide a comprehensive Persian calendar implementation in SQL Server, allowing you to work with Persian dates and perform various operations based on the Persian calendar system.

persiandateproject's People

Contributors

hdhamid avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.